
Ext.namespace('business.equipment.byq');

	// 主页面
	business.equipment.byq.MailViewer = Ext.extend(Ext.Panel, {
		
		/**
		 * 设备基本信息
		 */ 
		detailInfo  : null,
		
		/**
		 * 设备工作记录列表
		 */ 
		workRecord   : null,
		
		/**
		 * 风机
		 */ 
		fj     		: null,
		
		/**
		 * 冷却器
		 */ 
		lqq     	: null,
		
		/**
		 * 储油柜
		 */ 
		cyg    	 	: null,
		
		/**
		 * 压力释放阀
		 */ 
		ylsff     	: null,
		
		/**
		 * 有载开关气体继电器
		 */ 
		yzjdq     	: null,
		
		/**
		 * 本体气体继电器
		 */ 
		btqtjdq     : null,
		
		/**
		 * 油流继电器
		 */ 
		yljdq     	: null,
		
		/**
		 * 潜油泵
		 */ 
		qyb     	: null,
		
		/**
		 * 套管
		 */ 
		tg     		: null,
		
		/**
		 * 调压装置
		 */ 
		tyzz     	: null,
		
		border      : false,

		/**
	     * 初始化
		 */
		initComponent : function() {
			
			var obj = this;
			
			this.addListener('render', function() {
				obj.startViewer.defer(1, obj);
			});

			this.layout	= 'fit';
			
			business.equipment.byq.MailViewer.superclass.initComponent.call(this);
		},
		
		/**
		 * 初始化顺序处理
		 */
		startViewer : function() {
			
			// 初始化页面
			this.renderViewer();

		},
		
		/**
		 * 加载控件
		 */
		renderViewer : function() {

			var obj = this;

			//----------------------------------------------------------------------
			//	设备基本信息
			//----------------------------------------------------------------------
			this.detailInfo = new business.equipment.byq.DetailInfo({
				id                  : '0',
				layout              : 'fit',
				title               : '基本信息、参数'
			});

			//----------------------------------------------------------------------
			//	主页面 0 ：基本信息 1：设备工作记录列表
			//----------------------------------------------------------------------
			var viewer = new Ext.TabPanel({
				items 		: [obj.detailInfo],
				activeTab   : 0,
				defaults    : {
					closable: true
				}
			});
			
			// 第一个面板不能关闭
			viewer.getItem(0).closable = false;

			// 下拉框变化激活tab
			this.detailInfo.on('changeTab',  function (index) {
				
				if (index != 0 && sbid == '0') {
					Ext.MessageBox.alert('提示', '请先保存基本信息');
					viewer.setActiveTab(0);
					return;
				}

				// 没有激活过（按照ID取得）
				if(viewer.getItem(index + "") == undefined) {
					switch (index) {
			
						// 风机
						case 1:
							this.fj = new business.equipment.byq.Fj();
							this.fj.gridstore.baseParams['id'] = sbid;
							this.fj.gridstore.reload();
							viewer.insert(index, this.fj);
							break;
						
						// 冷却器
						case 2:
							this.lqq = new business.equipment.byq.Lqq();
							this.lqq.gridstore.baseParams['id'] = sbid;
							this.lqq.gridstore.reload();
							viewer.insert(index, this.lqq);
							break;

						// 储油柜
						case 3:
							this.cyg = new business.equipment.byq.Cyg();
							this.cyg.gridstore.baseParams['id'] = sbid;
							this.cyg.gridstore.reload();
							viewer.insert(index, this.cyg);
							break;
							
						/**
						 * 压力释放阀
						 */ 
						case 4:
							this.ylsff = new business.equipment.byq.Ylsff();
							this.ylsff.gridstore.baseParams['id'] = sbid;
							this.ylsff.gridstore.reload();
							viewer.insert(index, this.ylsff);
							break;
							
						/**
						 * 有载开关气体继电器
						 */ 
						case 5:
							this.yzjdq = new business.equipment.byq.Yzjdq();
							this.yzjdq.gridstore.baseParams['id'] = sbid;
							this.yzjdq.gridstore.reload();
							viewer.insert(index, this.yzjdq);
							break;
							
						/**
						 * 本体气体继电器
						 */ 
						case 6:
							this.btqtjdq = new business.equipment.byq.Btqtjdq();
							this.btqtjdq.gridstore.baseParams['id'] = sbid;
							this.btqtjdq.gridstore.reload();
							viewer.insert(index, this.btqtjdq);
							break;
							
						/**
						 * 油流继电器
						 */ 
						case 7:
							this.yljdq= new business.equipment.byq.Yljdq();
							this.yljdq.gridstore.baseParams['id'] = sbid;
							this.yljdq.gridstore.reload();
							viewer.insert(index, this.yljdq);
							break;
							
						/**
						 * 潜油泵
						 */ 
						case 8:
							this.qyb= new business.equipment.byq.Qyb();
							this.qyb.gridstore.baseParams['id'] = sbid;
							this.qyb.gridstore.reload();
							viewer.insert(index, this.qyb);
							break;
							
						/**
						 * 套管
						 */ 
						case 9:
							this.tg = new business.equipment.byq.Tg();
							this.tg.gridstore.baseParams['id'] = sbid;
							this.tg.gridstore.reload();
							viewer.insert(index, this.tg);
							break;
							
						/**
						 * 调压装置
						 */ 
						case 10:
							this.tyzz = new business.equipment.byq.Tyzz();
							this.tyzz.gridstore.baseParams['id'] = sbid;
							this.tyzz.gridstore.reload();
							viewer.insert(index, this.tyzz);
							break;
					}
				}
				viewer.setActiveTab(index);

			})

			this.add(viewer);

			if ((typeof this.layout) == "object") this.doLayout();

		}
		
	});

	/**
	 * 基本信息
	 */
	business.equipment.byq.DetailInfo = Ext.extend(Ext.Panel, {
		
		detail        : null,

		/**
	     * 初始化
		 */
		initComponent : function() {

			var obj = this;

			//----------------------------------------------------------------------
			//	详细信息页面
			//----------------------------------------------------------------------
			this.detail = new Ext.form.FormPanel({
				id : 'byq_detail',
				bodyStyle  : 'padding: 10px; background-color: #DFE8F6',
				method :'POST',
				frame  : true,
				labelAlign:'right',
				labelWidth:115,
				autoScroll : true,
				tbar :[
					{
						text:'保存',
						icon:contextpath + "/images/save2.gif",
						hidden:btn_save,
						handler: function() {
        					obj.submit();
        				}
					},'-',{
						text:'变电站选择',
						icon:contextpath + "/images/pass.gif",
						hidden:btn_save,
						handler: function() {
        					winbdztree.win.openCommentWindow();
        				}
					},'->',{
		    			text : '其他参数及工作记录：'
		    		} , {
                		xtype : 'combo',
                		width:150,
						id:'othertab',
						name : 'othertab',
						hiddenName : 'paramTab',
						store:new Ext.data.SimpleStore({
							fields:['itemId','itemName'],
							data:[['0','本体参数'],['1','风机'],['2','冷却器'],['3','储油柜'],
									['4','压力释放阀'],['5','有载开关气体继电器'],['6','本体气体继电器'],['7','油流继电器'],['8','潜油泵'],['9','套管']
									,['10','调压装置'],['11','设备工作记录列表']]
						}),
						displayField : 'itemName',
						valueField : 'itemId',
						forceSelection : true,
						selectOnFocus : true,
						editable : false,
						triggerAction : 'all',
						mode : 'local',
						emptyText:'请选择',
						listeners:{
              				select: function(combo, record, index) {
              					obj.fireEvent('changeTab', index);
 							}
          				}
					}
				],
		        items: [
		        	{
		        		xtype : 'fieldset',   
		        		layout : 'form',
		        		title : '基本信息【<font color=red>' + sblxname + '</font>】',
		        		items : [
			        	{
	        				layout:'column',
	        				items:[
	        					{	
	        						layout:'form',
	        						columnWidth:.3,
	        						items:[{
										xtype : 'textfield',
										fieldLabel :'变电站',
		                				width:100,
				            			name: 'bdzname',
				            			id : 'bdzname',
										allowBlank : false,
            							style:'background:#f0f0f0',
			            				readOnly:true
	        						}]
	        					}, {
	        						layout:'form',
	        						columnWidth:.3,
	        						items:[{
										xtype : 'textfield',
										fieldLabel :'运行间隔名称',
		                				width:100,
				            			name: 'typename',
				            			id : 'typename',
										allowBlank : false,
	            						style:'background:#f0f0f0',
				            			readOnly:true
									}]

	        					}, {
	        						layout:'form',
	        						columnWidth:.3,
	        						items:[{
										fieldLabel :'电压等级',
										name :'dydj',
										id : 'dydj',
										xtype : 'combo',
		                				width:100,
										hiddenName : 'entity.dydj',
										store : new Ext.data.Store({
											proxy : new Ext.data.HttpProxy({
												url : 'dic!getDicJson.do?dic.itemType=DYDJ'
											}),
											reader : new Ext.data.JsonReader({}, ['itemId', 'itemName']),
											autoLoad : true
										}),
										displayField : 'itemName',
										valueField : 'itemId',
										forceSelection : true,
										selectOnFocus : true,
										editable : false,
										triggerAction : 'all',
										mode : 'local',
										allowBlank : false,
										emptyText:'请选择'
	        						}]
	        					}
	            			]
	            			
			        	},{
	        				layout:'column',
	        				items:[
	        					{	
	        						layout:'form',
	        						columnWidth:.3,
	        						items:[{
										xtype : 'textfield',
										fieldLabel :'运行编号',
		                				width:100,
				            			name: 'entity.yxbh',
				            			id : 'entity.yxbh',
										allowBlank : false,
										maxLength :25
	        						}]
	        					}, {	
	        						layout:'form',
	        						columnWidth:.3,
	        						items:[{
										xtype : 'datefield',
										format:'Y-m-d',
										fieldLabel :'出厂日期',
		                				width:100,
		                				editable: false,
		                				//allowBlank : false,
				            			name: 'entity.ccrq',
				            			id : 'entity.ccrq'
	        						}]
	        					}, {	
	        						layout:'form',
	        						columnWidth:.3,
	        						items:[{
										xtype : 'datefield',
										format:'Y-m-d',
										fieldLabel :'投运日期',
		                				width:100,
		                				//allowBlank : false,
		                				editable: false,
				            			name: 'entity.tyrq',
				            			id : 'entity.tyrq'
			
	        						}]
	        					}
	            			]
	
	        			}, {
	        				layout:'column',
	        				items:[
	        					{	
	        						layout:'form',
	        						columnWidth:.6,
	        						items:[{
										xtype : 'textfield',
										fieldLabel :'生产厂家',
		                				anchor: '90%',
				            			name: 'entity.sccj',
				            			id : 'entity.sccj',
										allowBlank : false,
										maxLength :100
	        						}]
	        					}, {	
	        						layout:'form',
	        						columnWidth:.3,
	        						items:[{
										xtype : 'textfield',
										fieldLabel :'出厂编号',
		                				width:100,
				            			name: 'entity.ccbh',
				            			id : 'entity.ccbh',
										allowBlank : false,
										maxLength :50
	        						}]
	        					}
	            			]
	        			}]
		        	},{	
		        		xtype : 'fieldset',   
		        		layout : 'form',
		        		title : '本体参数',
		        		items : [
			        	{
	        				layout:'column',
	        				items:[
	        					{	
	        						layout:'form',
	        						columnWidth:.3,
	        						items:[{
										fieldLabel :'冷却方式',
										name :'lqfs',
										id : 'lqfs',
										xtype : 'combo',
		                				width:100,
										hiddenName : 'paramByq.lqfs',
										store : new Ext.data.Store({
											proxy : new Ext.data.HttpProxy({
												url : 'dic!getDicJson.do?dic.itemType=LQFS'
											}),
											reader : new Ext.data.JsonReader({}, ['itemId', 'itemName']),
											autoLoad : true,
											listeners:{'load' : function() {
												var r = new Ext.data.Record({itemId:'', itemName:''});
												Ext.getCmp('lqfs').store.insert(0,r);
												Ext.getCmp('lqfs').store.each(function(item) {
													if (item.get('itemId') == Ext.getCmp('lqfs').getValue()) {
														Ext.getCmp('lqfs').setRawValue(item.get('itemName'));
													}
												});	
											}}
										}),
										displayField : 'itemName',
										valueField : 'itemId',
										forceSelection : true,
										selectOnFocus : true,
										editable : false,
										triggerAction : 'all',
										mode : 'local',
										//allowBlank : false,
										emptyText:'请选择'
	        						}]
	        					}, {	
	        						layout:'form',
	        						columnWidth:.3,
	        						items:[{
										fieldLabel :'调压方式',
										name :'tyfs',
										id : 'tyfs',
										xtype : 'combo',
		                				width:100,
										hiddenName : 'paramByq.tyfs',
										store : new Ext.data.Store({
											proxy : new Ext.data.HttpProxy({
												url : 'dic!getDicJson.do?dic.itemType=TYFS'
											}),
											reader : new Ext.data.JsonReader({}, ['itemId', 'itemName']),
											autoLoad : true,
											listeners:{'load' : function() {
												var r = new Ext.data.Record({itemId:'', itemName:''});
												Ext.getCmp('tyfs').store.insert(0,r);
												Ext.getCmp('tyfs').store.each(function(item) {
													if (item.get('itemId') == Ext.getCmp('tyfs').getValue()) {
														Ext.getCmp('tyfs').setRawValue(item.get('itemName'));
													}
												});	
											}}
										}),
										displayField : 'itemName',
										valueField : 'itemId',
										forceSelection : true,
										selectOnFocus : true,
										editable : false,
										triggerAction : 'all',
										mode : 'local',
										//allowBlank : false,
										emptyText:'请选择'
	        						}]
	        					}, {	
	        						layout:'form',
	        						columnWidth:.3,
	        						items:[{        							
										xtype : 'textfield',
										fieldLabel :'联结组标号',
		                				width:100,
				            			name: 'paramByq.ljzbh',
				            			id : 'paramByq.ljzbh',
										//allowBlank : false,
										maxLength :50
									}]
	        					}]

		       			},{		
	        				layout:'column',
	        				items:[
	        					{
	        						layout:'form',
	        						columnWidth:.3,
	        						items:[{
										fieldLabel :'是否自耦变压器',
										name :'sfzobyq',
										id : 'sfzobyq',
										xtype : 'combo',
		                				width:100,
										hiddenName : 'paramByq.sfzobyq',
										store:new Ext.data.SimpleStore({
											fields:['itemId','itemName'],
											data:[['',''],['0','否'],['1','是']]
				
										}),
										displayField : 'itemName',
										valueField : 'itemId',
										forceSelection : true,
										selectOnFocus : true,
										editable : false,
										triggerAction : 'all',
										mode : 'local',
										allowBlank : false
	        						}]
	        					}]
		       			},{		
	        				layout:'column',
	        				items:[
	        					{
	        						layout:'form',
	        						columnWidth:.3,
	        						items:[{
										xtype : 'numberfield',
		                				allowNegative : false,
		                				allowDecimals:false,
										fieldLabel :'高压侧额定电压（MPa）',
		                				width:100,
				            			name: 'paramByq.gyceddy',
				            			id : 'paramByq.gyceddy',
										//allowBlank : false,
										maxLength :8
	        						}]
	        					}, {	
	        						layout:'form',
	        						columnWidth:.3,
	        						items:[{
										xtype : 'numberfield',
										fieldLabel :'中压侧额定电压（MPa）',
		                				width:100,
		                				allowNegative : false,
		                				allowDecimals:false,
		                				//allowBlank : false,
				            			name: 'paramByq.zyceddy',
				            			id : 'paramByq.zyceddy',
				            			maxLength :8
	        						}]
	        					}, {	
	        						layout:'form',
	        						columnWidth:.3,
	        						items:[{
										xtype : 'numberfield',
										fieldLabel :'低压侧额定电压（MPa）',
		                				width:100,
		                				allowNegative : false,
		                				allowDecimals:false,
		                				//allowBlank : false,
				            			name: 'paramByq.dyceddy',
				            			id : 'paramByq.dyceddy',
				            			maxLength :8
	        						}]
	        					}]
		       			},{		
	        				layout:'column',
	        				items:[
	        					{
	        						layout:'form',
	        						columnWidth:.3,
	        						items:[{
										xtype : 'numberfield',
		                				allowNegative : false,
		                				allowDecimals:false,
										fieldLabel :'高压侧额定电流（A）',
		                				width:100,
				            			name: 'paramByq.gyceddl',
				            			id : 'paramByq.gyceddl',
										//allowBlank : false,
										maxLength :8
	        						}]
	        					}, {	
	        						layout:'form',
	        						columnWidth:.3,
	        						items:[{
										xtype : 'numberfield',
										fieldLabel :'中压侧额定电流（A）',
		                				width:100,
		                				allowNegative : false,
		                				allowDecimals:false,
		                				//allowBlank : false,
				            			name: 'paramByq.zyceddl',
				            			id : 'paramByq.zyceddl',
				            			maxLength :8
	        						}]
	        					}, {	
	        						layout:'form',
	        						columnWidth:.3,
	        						items:[{
										xtype : 'numberfield',
										fieldLabel :'低压侧额定电流（A）',
		                				width:100,
		                				allowNegative : false,
		                				allowDecimals:false,
		                				//allowBlank : false,
				            			name: 'paramByq.dyceddl',
				            			id : 'paramByq.dyceddl',
				            			maxLength :8
	        						}]
	        					}]
		       			},{		
	        				layout:'column',
	        				items:[
	        					{
	        						layout:'form',
	        						columnWidth:.3,
	        						items:[{
										xtype : 'numberfield',
		                				allowNegative : false,
		                				allowDecimals:false,
										fieldLabel :'高压侧额定容量（MVA）',
		                				width:100,
				            			name: 'paramByq.gyceddr',
				            			id : 'paramByq.gyceddr',
										//allowBlank : false,
										maxLength :8
	        						}]
	        					}, {	
	        						layout:'form',
	        						columnWidth:.3,
	        						items:[{
										xtype : 'numberfield',
										fieldLabel :'中压侧额定容量（MVA）',
		                				width:100,
		                				allowNegative : false,
		                				allowDecimals:false,
		                				//allowBlank : false,
				            			name: 'paramByq.zyceddr',
				            			id : 'paramByq.zyceddr',
				            			maxLength :8
	        						}]
	        					}, {	
	        						layout:'form',
	        						columnWidth:.3,
	        						items:[{
										xtype : 'numberfield',
										fieldLabel :'低压侧额定容量（MVA）',
		                				width:100,
		                				allowNegative : false,
		                				allowDecimals:false,
		                				//allowBlank : false,
				            			name: 'paramByq.dyceddr',
				            			id : 'paramByq.dyceddr',
				            			maxLength :8
	        						}]
	        					}]
		       			},{		
	        				layout:'column',
	        				items:[
	        					{
	        						layout:'form',
	        						columnWidth:.3,
	        						items:[{
										xtype : 'numberfield',
		                				allowNegative : false,
		                				allowDecimals:false,
										fieldLabel :'高中短路阻抗（%）',
		                				width:100,
				            			name: 'paramByq.gzdlzk',
				            			id : 'paramByq.gzdlzk',
										//allowBlank : false,
										maxLength :8
	        						}]
	        					}, {	
	        						layout:'form',
	        						columnWidth:.3,
	        						items:[{
										xtype : 'numberfield',
										fieldLabel :'高低短路阻抗（%）',
		                				width:100,
		                				allowNegative : false,
		                				allowDecimals:false,
		                				//allowBlank : false,
				            			name: 'paramByq.gddlzk',
				            			id : 'paramByq.gddlzk',
				            			maxLength :8
	        						}]
	        					}, {	
	        						layout:'form',
	        						columnWidth:.3,
	        						items:[{
										xtype : 'numberfield',
										fieldLabel :'中低短路阻抗（%）',
		                				width:100,
		                				allowNegative : false,
		                				allowDecimals:false,
		                				//allowBlank : false,
				            			name: 'paramByq.zddlzk',
				            			id : 'paramByq.zddlzk',
				            			maxLength :8
	        						}]
	        					}]
		       			},{		
	        				layout:'column',
	        				items:[
	        					{
	        						layout:'form',
	        						columnWidth:.3,
	        						items:[{
										xtype : 'numberfield',
		                				allowNegative : false,
		                				allowDecimals:false,
										fieldLabel :'高中负载损耗（kW）',
		                				width:100,
				            			name: 'paramByq.gzfzsh',
				            			id : 'paramByq.gzfzsh',
										//allowBlank : false,
										maxLength :8
	        						}]
	        					}, {	
	        						layout:'form',
	        						columnWidth:.3,
	        						items:[{
										xtype : 'numberfield',
										fieldLabel :'高低负载损耗（kW）',
		                				width:100,
		                				allowNegative : false,
		                				allowDecimals:false,
		                				//allowBlank : false,
				            			name: 'paramByq.gdfzsh',
				            			id : 'paramByq.gdfzsh',
				            			maxLength :8
	        						}]
	        					}, {	
	        						layout:'form',
	        						columnWidth:.3,
	        						items:[{
										xtype : 'numberfield',
										fieldLabel :'中低负载损耗（kW）',
		                				width:100,
		                				allowNegative : false,
		                				allowDecimals:false,
		                				//allowBlank : false,
				            			name: 'paramByq.zdfzsh',
				            			id : 'paramByq.zdfzsh',
				            			maxLength :8
	        						}]
	        					}]
		       			},{		
	        				layout:'column',
	        				items:[
	        					{
	        						layout:'form',
	        						columnWidth:.3,
	        						items:[{
										xtype : 'numberfield',
		                				allowNegative : false,
		                				allowDecimals:false,
										fieldLabel :'空载电流（%）',
		                				width:100,
				            			name: 'paramByq.kzdl',
				            			id : 'paramByq.kzdl',
										//allowBlank : false,
										maxLength :8
	        						}]
	        					}, {	
	        						layout:'form',
	        						columnWidth:.3,
	        						items:[{
										xtype : 'numberfield',
										fieldLabel :'空载损耗（kW）',
		                				width:100,
		                				allowNegative : false,
		                				allowDecimals:false,
		                				//allowBlank : false,
				            			name: 'paramByq.kzsh',
				            			id : 'paramByq.kzsh',
				            			maxLength :8
	        						}]
	        					}]
		       			},{		
	        				layout:'column',
	        				items:[
	        					{
	        						layout:'form',
	        						columnWidth:.3,
	        						items:[{
										xtype : 'textfield',
		                				allowNegative : false,
		                				allowDecimals:false,
										fieldLabel :'调压极数',
		                				width:100,
				            			name: 'paramByq.tyjs',
				            			id : 'paramByq.tyjs',
										//allowBlank : false,
										maxLength :8
	        						}]
	        					}, {	
	        						layout:'form',
	        						columnWidth:.3,
	        						items:[{
										xtype : 'textfield',
										fieldLabel :'调压比例',
		                				width:100,
		                				allowNegative : false,
		                				allowDecimals:false,
		                				//allowBlank : false,
				            			name: 'paramByq.tybl',
				            			id : 'paramByq.tybl',
				            			maxLength :8
	        						}]
	        					}]
		       			},{		
	        				layout:'column',
	        				items:[
	        					{
	        						layout:'form',
	        						columnWidth:.3,
	        						items:[{
										xtype : 'numberfield',
		                				allowNegative : false,
		                				allowDecimals:false,
										fieldLabel :'总重量（t）',
		                				width:100,
				            			name: 'paramByq.zzl',
				            			id : 'paramByq.zzl',
										//allowBlank : false,
										maxLength :8
	        						}]
	        					}, {	
	        						layout:'form',
	        						columnWidth:.3,
	        						items:[{
										xtype : 'numberfield',
										fieldLabel :'器身重（t）',
		                				width:100,
		                				allowNegative : false,
		                				allowDecimals:false,
		                				//allowBlank : false,
				            			name: 'paramByq.qsz',
				            			id : 'paramByq.qsz',
				            			maxLength :8
	        						}]
	        					}, {	
	        						layout:'form',
	        						columnWidth:.3,
	        						items:[{
										xtype : 'numberfield',
										fieldLabel :'运输重量（t）',
		                				width:100,
		                				allowNegative : false,
		                				allowDecimals:false,
		                				//allowBlank : false,
				            			name: 'paramByq.yszl',
				            			id : 'paramByq.yszl',
				            			maxLength :8
	        						}]
	        					}]
		       			},{		
	        				layout:'column',
	        				items:[
	        					{
	        						layout:'form',
	        						columnWidth:.3,
	        						items:[{
										fieldLabel :'油箱结构',
										name :'yxjg',
										id : 'yxjg',
										xtype : 'combo',
		                				width:100,
										hiddenName : 'paramByq.yxjg',
										store : new Ext.data.Store({
											proxy : new Ext.data.HttpProxy({
												url : 'dic!getDicJson.do?dic.itemType=YXJG'
											}),
											reader : new Ext.data.JsonReader({}, ['itemId', 'itemName']),
											autoLoad : true,
											listeners:{'load' : function() {
												var r = new Ext.data.Record({itemId:'', itemName:''});
												Ext.getCmp('yxjg').store.insert(0,r);
												Ext.getCmp('yxjg').store.each(function(item) {
													if (item.get('itemId') == Ext.getCmp('yxjg').getValue()) {
														Ext.getCmp('yxjg').setRawValue(item.get('itemName'));
													}
												});	
											}}
										}),
										displayField : 'itemName',
										valueField : 'itemId',
										forceSelection : true,
										selectOnFocus : true,
										editable : false,
										triggerAction : 'all',
										mode : 'local',
										//allowBlank : false,
										emptyText:'请选择'
	        						}]
	        					}, {	
	        						layout:'form',
	        						columnWidth:.3,
	        						items:[{
										xtype : 'numberfield',
										fieldLabel :'上节油箱重（t）',
		                				width:100,
		                				allowNegative : false,
		                				allowDecimals:false,
		                				//allowBlank : false,
				            			name: 'paramByq.sjyxz',
				            			id : 'paramByq.sjyxz',
				            			maxLength :8
	        						}]
	        					}]
		       			},{		
	        				layout:'column',
	        				items:[
	        					{
	        						layout:'form',
	        						columnWidth:.3,
	        						items:[{
										xtype : 'textfield',
		                				allowNegative : false,
		                				allowDecimals:false,
										fieldLabel :'油号',
		                				width:100,
				            			name: 'paramByq.yh',
				            			id : 'paramByq.yh',
										//allowBlank : false,
										maxLength :25
	        						}]
	        					}, {	
	        						layout:'form',
	        						columnWidth:.3,
	        						items:[{
										xtype : 'textfield',
										fieldLabel :'油产地',
		                				width:100,
		                				allowNegative : false,
		                				allowDecimals:false,
		                				//allowBlank : false,
				            			name: 'paramByq.ycd',
				            			id : 'paramByq.ycd',
				            			maxLength :50
	        						}]
	        					}, {	
	        						layout:'form',
	        						columnWidth:.3,
	        						items:[{
										xtype : 'numberfield',
										fieldLabel :'油重量（t）',
		                				width:100,
		                				allowNegative : false,
		                				allowDecimals:false,
		                				//allowBlank : false,
				            			name: 'paramByq.yzl',
				            			id : 'paramByq.yzl',
				            			maxLength :8
	        						}]
	        					}]
		       				}]
        			},{
            			xtype: 'hidden',
            			name: 'entity.id',
            			id:'entity.id',
            			value : '0'
        			},{
            			xtype: 'hidden',
            			name: 'entity.modelid',
            			id:'entity.modelid',
            			value:'0'
        			},{
            			xtype: 'hidden',
            			name: 'entity.bdzid',
            			id:'entity.bdzid'
        			},{
            			xtype: 'hidden',
            			name: 'entity.typeid',
            			id:'entity.typeid'
        			},{
            			xtype: 'hidden',
            			name: 'entity.sblx',
            			id:'entity.sblx'
        			},{
            			xtype: 'hidden',
            			name: 'entity.state',
            			id:'entity.state'
        			},{
            			xtype: 'hidden',
            			name: 'paramByq.id',
            			id:'paramByq.id',
            			value : '0'
        			},{
            			xtype: 'hidden',
            			name: 'paramByq.baseid',
            			id:'paramByq.baseid',
            			value : '0'
        			}
		   	   ]
			});

			//----------------------------------------------------------------------
			//	加载数据
			//----------------------------------------------------------------------
			this.loadData();
			
			this.items = [this.detail];
			
			this.addEvents('changeTab');

			business.equipment.byq.DetailInfo.superclass.initComponent.call(this);

		},
		
		/**
		 * 提交保存
		 */
		submit: function() {
			
			var obj = this;

			// 验证有效性
        	if (!obj.detail.getForm().isValid()) {
        		return;
        	} 

			// 提交
			obj.detail.getForm().submit({
				waitMsg :'保存中...',
				url:'equip!save.do',
				success : function(form, action) {
					Ext.MessageBox.alert('提示', action.result.msg);
					if (!Ext.isEmpty(action.result.paraid)) {
						// 基本信息
						Ext.getCmp('entity.id').setValue(action.result.id);
						Ext.getCmp('entity.modelid').setValue(action.result.modelid);
						sbid = action.result.id;
						// 其他参数
						Ext.getCmp('paramByq.id').setValue(action.result.paraid);
						Ext.getCmp('paramByq.baseid').setValue(action.result.id);
						// 父窗口刷新
						parent.mailViewer.sb.gridstore.reload();

					}
				},
				failure : function(action) {
					Ext.MessageBox.alert('提示', '保存失败。');
				}
			});
		},

		/**
		 * 加载数据
		 */
		loadData :function () {
		
			var obj = this;
			
			// 新建时
			if (sbid == '0') {
				Ext.getCmp('entity.state').setValue(parent.mailViewer.state);
				Ext.getCmp('entity.bdzid').setValue(parent.mailViewer.bdzid);
				Ext.getCmp('entity.typeid').setValue(parent.mailViewer.typeid);
				Ext.getCmp('bdzname').setValue(parent.mailViewer.bdzname);
				Ext.getCmp('typename').setValue(parent.mailViewer.typename);
				Ext.getCmp('entity.sblx').setValue(sblx);
				
				// 修改时
		    } else {

				Ext.Ajax.request({
					method :'POST',
					url :'equip!initBaseInfo.do',
					params : {
						id : sbid,
						modelid : modelid
					},
					success : function(response, options) { 

						var rtn = Ext.decode(response.responseText);
						
						// 基本信息
						for (var p in rtn[0]) {
							try {
								obj.detail.getForm().findField("entity." + p).setValue(rtn[0][p]);
							} catch (e){
							}
						}
						obj.detail.getForm().findField("entity.dydj").setRawValue(rtn[0]["dydj"] + 'kV');
						obj.detail.getForm().findField("bdzname").setRawValue(bdzname);
						obj.detail.getForm().findField("typename").setRawValue(typename);
						
						// 其他参数
						for (var p in rtn[1]) {
							try {
								obj.detail.getForm().findField("paramByq." + p).setValue(rtn[1][p] == '0' ? '' : rtn[1][p]);
							} catch (e){
								//alert(p);
							}
						}
						obj.detail.getForm().findField("paramByq.sfzobyq").setValue(rtn[1]['sfzobyq']);
						obj.detail.getForm().findField("paramByq.sfzobyq").setRawValue(rtn[1]['sfzobyq'] == '1' ? '是' : '否');
					},
					failure : function() {
						Ext.MessageBox.alert('提示 ', '提取数据失败！');
					}
				});
		    }
		}

	});
	
	/**
	 * 设备工作记录列表
	 */
	business.equipment.byq.WorkRecord = Ext.extend(Ext.Panel, {
		
		actived   : false,
		
		/**
		 * 设备工作记录列表
		 */
		grid      : null,
		
		/**
		 * 设备工作记录列表
		 */
		gridstore : null,

		/**
	     * 初始化
		 */
		initComponent : function() {

			var obj = this;

			//----------------------------------------------------------------------
			//	列表数据源
			//----------------------------------------------------------------------
			this.gridstore = new Ext.data.Store({
				proxy :new Ext.data.HttpProxy({
					url :'equip!getEquipList.do'
				}),
				reader :new Ext.data.JsonReader({
					root :'result',
					totalProperty :'totalCount',
					fields : ['id', 'bdzname', 'bdzid', 'typename', 'dydjname', 'sblxname', 'tyrq', 'state','yxbh']
				}),
				autoLoad:false,
				remoteSort :false
			});

			//----------------------------------------------------------------------
			//	加载列表
			//----------------------------------------------------------------------
			this.grid = new Ext.grid.GridPanel({
				id					: "byq_wordkrecord_grid",
				store 				: obj.gridstore,
				layout 				: 'fit',
				enableDragDrop		: false,
				stripeRows			: true,
				animCollapse		: false,
				cm: new Ext.grid.ColumnModel({
	        		defaults: {
	            		sortable: true
	        		},
	        		columns: [
	        			new Ext.grid.RowNumberer(),
	            		//sm,
						{	id:'id',
							header :"序号",
							width :50,
							dataIndex :'id',
							sortable :true,
							hidden :true
						}, {
							header :"变电站",
							width :70,
							dataIndex :'bdzname',
							sortable :true,
							align:'center'
						}, {
							header :"隔断、瓶柜",
							width :70,
							dataIndex :'typename',
							sortable :true,
							align:'center'
						},{
							header :"设备类型",
							width :120,
							dataIndex :'sblxname',
							sortable :true,
							align:'center'
						},{
							header :"电压等级",
							dataIndex :'dydjname',
							sortable :true,
							align:'center'
						},{
							header :"投运日期",
							width :120,
							dataIndex :'tyrq',
							sortable :true,
							align:'center'
						}]
				}),
				selModel  : new Ext.grid.RowSelectionModel({singleSelect : true}),
				loadMask : {
					msg :'载入中,请稍候...'
				},
				viewConfig:{
					forceFit:true
				},
				tbar :[
					{
						text :'刷新',
						cls:'x-btn-text-icon',
        				icon:contextpath + '/images/page_find.png',
			            handler:function() {
			            	obj.gridstore.reload();
        				}
					}, btn_insert ? '' : '-',{
						text :'新建',
						cls:'x-btn-text-icon',
        				icon:contextpath + '/images/add.gif',
        				hidden:btn_insert
					}, btn_delete ? '' : '-',{
						text :'删除',
						cls:'x-btn-text-icon',
        				icon:contextpath + '/images/delete.gif',
        				hidden:btn_delete,
        				handler:function() {
        					obj.deleteWorkRecord();
        				}
					}
				],
				bbar : new Ext.PagingToolbar({
					store : obj.gridstore,
					pageSize:100,
					displayInfo :true,
					displayMsg :'共 {2} 条',
					emptyMsg :"没有数据显示！"
				}),
				listeners:{'rowdblclick':function(row) {
					//obj.getDetail();
				}}
			});

			this.items = [
				this.grid
			]

			business.equipment.byq.WorkRecord.superclass.initComponent.call(this);
		
		},

		/**
		 * 删除
		 */
		deleteWorkRecord: function() {
			
//			var obj = this;
//			
//			if (!obj.grid.getSelectionModel().hasSelection()) {
//				Ext.MessageBox.alert("提示","请先选择要删除的记录");
//				return;
//			}
//			
//			var ids = obj.grid.getSelectionModel().getSelected()['data']['id'];
//			
//			Ext.MessageBox.confirm('提示', '确定要删除选中的【' + obj.grid.getSelectionModel().getSelected()['data']['jgmc'] + '】记录吗？', function (btn) {
//				
//				if (btn == 'yes') {
//
//					Ext.Ajax.request({
//						method :'POST',
//						url :'equip!deleteJg.do',
//						params : {
//							id :ids
//						},
//						success : function(response) {
//							
//							Ext.MessageBox.alert('提示', response.responseText, function () {
//								obj.grid.store.reload();
//							});
//						},
//						failure : function() {
//							Ext.MessageBox.alert('提示', '删除失败！');
//						}
//					});
//				}
//
//			});
			
		},
		
		/**
		 * 新建时
		 */
		insertWorkRecord: function(id) {
			//this.fireEvent('addTab', sblx, sblxname);
		}
	
	});

	/**
	 * 风机
	 */
	business.equipment.byq.Fj = Ext.extend(Ext.Panel, {
		
		id 			: '1', 
		title		: '风机',
		layout		: 'border',
		
		/**
		 * 绕组参数列表
		 */
		grid 		: null,
		
		/**
		 * 绕组参数数据源
		 */
		gridstore 	: null,

		/**
		 * 绕组参数详细信息
		 */
		detail 		: null,

		/**
	     * 初始化
		 */
		initComponent : function() {
			
			var obj = this;
			
			//----------------------------------------------------------------------
			//	列表数据源
			//----------------------------------------------------------------------
			this.gridstore = new Ext.data.Store({
				proxy :new Ext.data.HttpProxy({
					url :'equip!getParamList.do?sblx=001-1'
				}),
				reader :new Ext.data.JsonReader({
					root :'result',
					totalProperty :'totalCount',
					fields : ['id', 'bdzid', 'xh', 'eddy', 'eddl', 'edgl','edzs','ylzj','fl','zl','scrq','sccj','sl','bz']
				}),
				autoLoad:false,
				remoteSort :false
			});

			//----------------------------------------------------------------------
			//	加载列表
			//----------------------------------------------------------------------
			this.grid = new Ext.grid.GridPanel({
				id					: "byzgrid1",
				store 				: obj.gridstore,
				region 				: 'west',
				width				: 600,
				//ddGroup				: "rzGridDDGroup",
				//enableDragDrop		: true,
				stripeRows			: true,
				split				: true,
				collapsible			: true,
				animCollapse		: false,
				cm: new Ext.grid.ColumnModel({
	        		defaults: {
	            		sortable: true
	        		},
	        		columns: [
	        			new Ext.grid.RowNumberer(),
	            		//sm,
						{	id:'id',
							header :"序号",
							width :50,
							dataIndex :'id',
							sortable :true,
							hidden :true
						}, {
							header :"型号",
							width :70,
							dataIndex :'xh',
							sortable :true,
							align:'center'
						}, {
							header :"额定电压（V）",
							width :120,
							dataIndex :'eddy',
							sortable :true,
							align:'center'
						},{
							header :"额定电流（A）",
							width :120,
							dataIndex :'eddl',
							sortable :true,
							align:'center'
						},{
							header :"数量",
							width :120,
							dataIndex :'sl',
							sortable :true,
							align:'center'
						},{
							header :"生产厂家",
							dataIndex :'sccj',
							sortable :true,
							align:'center'
						}]
				}),
				selModel  : new Ext.grid.RowSelectionModel({singleSelect : true}),
				loadMask : {
					msg :'载入中,请稍候...'
				},
				viewConfig:{
					forceFit:true
				},
				tbar :[
					{
						text :'刷新',
						cls:'x-btn-text-icon',
        				icon:contextpath + '/images/page_find.png',
			            handler:function() {
			            	obj.gridstore.reload();
        				}
					}, btn_delete ? '' : '-',{
						text :'删除',
						cls:'x-btn-text-icon',
        				icon:contextpath + '/images/delete.gif',
        				hidden:btn_delete,
        				handler:function() {
        					obj.deleteParam();
        				}
					}
				],
				bbar : new Ext.PagingToolbar({
					store : obj.gridstore,
					pageSize:100,
					displayInfo :true,
					displayMsg :'共 {2} 条',
					emptyMsg :"没有数据显示！"
				}),
				listeners:{'rowdblclick':function(row) {
					obj.getDetail();
				}}
			});
			
			//----------------------------------------------------------------------
			//	加载详细信息
			//----------------------------------------------------------------------
			this.detail = new Ext.form.FormPanel({
				id : 'byqdetail1',
				region : 'center',
				bodyStyle  : 'padding: 10px; background-color: #DFE8F6',
				method :'POST',
				labelAlign:'right',
				tbar :[
					{
						id :'rz_insert',
						text :'新建',
						cls:'x-btn-text-icon',
        				icon:contextpath + '/images/add.gif',
			            hidden:btn_insert,
        				handler:function() {
        					obj.detail.getForm().reset();
        					obj.detail.getForm().findField("paramByqFj.baseid").setValue(sbid);
        				}
					}, btn_save ? '' : '-',{
						text:'保存',
						icon:contextpath + "/images/save2.gif",
						hidden:btn_save,
						handler: function() {
        					obj.submit();
        				}
					}
				],
		        items: [
	        	{
					xtype : 'textfield',
					fieldLabel :'设备类型',
    				width: 150,
        			name: 'sblxrd1',
        			id : 'sblxrd1',
					allowBlank : false,
					readOnly : true,
					value     : sblxname,
            		style:'background:#f0f0f0'
        		}, {
					xtype : 'textfield',
					fieldLabel :'型号',
    				width: 150,
        			name: 'paramByqFj.xh',
        			id : 'paramByqFj.xh',
					allowBlank : false,
					maxLength :25
       			}, {
        			xtype : 'numberfield',       				
					fieldLabel :'额定电压（V）',
					width: 150,
        			name: 'paramByqFj.eddy',
        			id : 'paramByqFj.eddy',
					allowBlank : false,
					maxLength :8
       			}, {
        			xtype : 'numberfield',
    				allowNegative : false,
    				allowDecimals:false,
					fieldLabel :'额定电流（A）',
    				width: 150,
        			name: 'paramByqFj.eddl',
        			id : 'paramByqFj.eddl',
					allowBlank : false,
					maxLength :8
        		}, {
        			xtype : 'numberfield',
					fieldLabel :'额定功率（kW）',
    				width: 150,
        			name: 'paramByqFj.edgl',
        			id : 'paramByqFj.edgl',
					allowBlank : false,
					maxLength :8
        		}, {
        			xtype : 'numberfield',
					fieldLabel :'额定转速（rpm）',
    				width: 150,
        			name: 'paramByqFj.edzs',
        			id : 'paramByqFj.edzs',
					//allowBlank : false,
					maxLength :8
        		}, {
        			xtype : 'numberfield',
					fieldLabel :'叶轮直径（mm）',
    				width: 150,
        			name: 'paramByqFj.ylzj',
        			id : 'paramByqFj.ylzj',
					//allowBlank : false,
					maxLength :8
        		}, {
        			xtype : 'numberfield',
					fieldLabel :'风量',
    				width: 150,
        			name: 'paramByqFj.fl',
        			id : 'paramByqFj.fl',
					//allowBlank : false,
					maxLength :8
        		}, {
        			xtype : 'numberfield',
					fieldLabel :'重量（kg）',
    				width: 150,
        			name: 'paramByqFj.zl',
        			id : 'paramByqFj.zl',
					//allowBlank : false,
					maxLength :8
        		}, {
        			xtype : 'datefield',
					fieldLabel :'生产日期',
    				width: 150,
        			name: 'paramByqFj.scrq',
        			id : 'paramByqFj.scrq',
					//allowBlank : false,
        			editable:false,
        			format:'Y-m-d'
        		}, {
        			xtype : 'textfield',
					fieldLabel :'厂家',
    				width: 150,
        			name: 'paramByqFj.sccj',
        			id : 'paramByqFj.sccj',
					//allowBlank : false,
					maxLength :50
        		}, {
        			xtype : 'numberfield',
					fieldLabel :'数量（台）',
    				width: 150,
        			name: 'paramByqFj.sl',
        			id : 'paramByqFj.sl',
					//allowBlank : false,
					maxLength :8
        		}, {
        			xtype : 'textfield',
					fieldLabel :'备注',
    				width: 150,
        			name: 'paramByqFj.bz',
        			id : 'paramByqFj.bz',
					//allowBlank : false,
					maxLength :50
        		}, {
        			xtype: 'hidden',
        			name: 'paramByqFj.id',
        			id:'paramByqFj.id',
        			value:'0'
        		},{
        			xtype: 'hidden',
        			name: 'paramByqFj.baseid',
        			id:'paramByqFj.baseid',
        			value:sbid
        		},{
        			xtype: 'hidden',
        			name: 'sblx',
        			id:'sblx',
        			value:'001-1'
        		},{
        			xtype: 'hidden',
        			name: 'id',
        			id:'id',
        			value:'0'
        		}]
			});

			this.items = [this.grid, this.detail];
			
			business.equipment.byq.Fj.superclass.initComponent.call(this);

		},

		/**
		 * 提交保存
		 */
		submit: function() {
			
			var obj = this;
			
			// 验证有效性
        	if (this.detail.getForm().isValid()) {
        		
        		// 重新赋值设备ID
        		obj.detail.getForm().findField("paramByqFj.baseid").setValue(sbid);

				// 提交
				this.detail.getForm().submit({
					waitMsg :'保存中...',
					url:'equip!saveParam.do',
					success : function(form, action) {
						
						Ext.MessageBox.alert('提示', action.result.msg, function() {
						
							if (!Ext.isEmpty(action.result.id)) {
								obj.detail.getForm().findField("paramByqFj.id").setValue(action.result.id);
								obj.detail.getForm().findField("id").setValue(action.result.id);
								obj.gridstore.baseParams['id'] = sbid;
								obj.gridstore.reload();
							}
						});
					},
					failure : function(action) {
						Ext.MessageBox.alert('提示', '保存失败。');
					}
				});
        	}
			
		},
		
		/**
		 * 删除
		 */
		deleteParam: function() {
			
			var obj = this;
			
			if (!obj.grid.getSelectionModel().hasSelection()) {
				Ext.MessageBox.alert("提示","请先选择要删除的记录");
				return;
			}
			
			var ids = obj.grid.getSelectionModel().getSelected()['data']['id'];
			
			Ext.MessageBox.confirm('提示', '确定要删除选中的记录吗？', function (btn) {
				
				if (btn == 'yes') {

					Ext.Ajax.request({
						method :'POST',
						url :'equip!deleteParam.do?sblx=001-1',
						params : {
							id :ids
						},
						success : function(response) {
							
							Ext.MessageBox.alert('提示', response.responseText, function () {
								obj.grid.store.reload();
							});
						},
						failure : function() {
							Ext.MessageBox.alert('提示', '删除失败！');
						}
					});
				}

			});
			
		},
		
		/**
		 * 获得详细信息
		 */
		getDetail: function() {

			var record = this.grid.getSelectionModel().getSelected()['data'];
			
			for (var p in record) {
				
				try {
					this.detail.getForm().findField("paramByqFj." + p).setValue(record[p]);
				} catch (e) {
					
				}
				
				this.detail.getForm().findField('id').setValue(record['id']);
			}
		}
	
	});
	
	/**
	 * 冷却器
	 */
	business.equipment.byq.Lqq = Ext.extend(Ext.Panel, {
		
		id 			: '2', 
		title		: '冷却器',
		layout		: 'border',
		
		/**
		 * 绕组参数列表
		 */
		grid : null,
		
		/**
		 * 绕组参数数据源
		 */
		gridstore : null,

		/**
		 * 绕组参数详细信息
		 */
		detail : null,

		/**
	     * 初始化
		 */
		initComponent : function() {
			
			var obj = this;
			
			//----------------------------------------------------------------------
			//	列表数据源
			//----------------------------------------------------------------------
			this.gridstore = new Ext.data.Store({
				proxy :new Ext.data.HttpProxy({
					url :'equip!getParamList.do?sblx=001-2'
				}),
				reader :new Ext.data.JsonReader({
					root :'result',
					totalProperty :'totalCount',
					fields : ['id', 'bdzid', 'xh', 'sl', 'cyl', 'jkyw','jkfw','edfly','edyly','zl','ccxh','sccj','scrq','bz']
				}),
				autoLoad:false,
				remoteSort :false
			});
 
			//----------------------------------------------------------------------
			//	加载列表
			//----------------------------------------------------------------------
			this.grid = new Ext.grid.GridPanel({
				id					: "byzgrid2",
				store 				: obj.gridstore,
				region 				: 'west',
				width				: 600,
				//ddGroup				: "rzGridDDGroup",
				//enableDragDrop		: true,
				stripeRows			: true,
				split				: true,
				collapsible			: true,
				animCollapse		: false,
				cm: new Ext.grid.ColumnModel({
	        		defaults: {
	            		sortable: true
	        		},
	        		columns: [
	        			new Ext.grid.RowNumberer(),
	            		//sm,
						{	id:'id',
							header :"序号",
							width :50,
							dataIndex :'id',
							sortable :true,
							hidden :true
						}, {
							header :"冷却器型号",
							width :70,
							dataIndex :'xh',
							sortable :true,
							align:'center'
						}, {
							header :"数量",
							width :200,
							dataIndex :'sl',
							sortable :true,
							align:'center'
						},{
							header :"充油量",
							width :120,
							dataIndex :'cyl',
							sortable :true,
							align:'center'
						},{
							header :"制造厂家",
							dataIndex :'sccj',
							sortable :true,
							align:'center'
						}]
				}),
				selModel  : new Ext.grid.RowSelectionModel({singleSelect : true}),
				loadMask : {
					msg :'载入中,请稍候...'
				},
				viewConfig:{
					forceFit:true
				},
				tbar :[
					{
						text :'刷新',
						cls:'x-btn-text-icon',
        				icon:contextpath + '/images/page_find.png',
			            handler:function() {
			            	obj.gridstore.reload();
        				}
					}, btn_delete ? '' : '-',{
						text :'删除',
						cls:'x-btn-text-icon',
        				icon:contextpath + '/images/delete.gif',
        				hidden:btn_delete,
        				handler:function() {
        					obj.deleteParam();
        				}
					}
				],
				bbar : new Ext.PagingToolbar({
					store : obj.gridstore,
					pageSize:100,
					displayInfo :true,
					displayMsg :'共 {2} 条',
					emptyMsg :"没有数据显示！"
				}),
				listeners:{'rowdblclick':function(row) {
					obj.getDetail();
				}}
			});
			
			//----------------------------------------------------------------------
			//	加载详细信息
			//----------------------------------------------------------------------
			this.detail = new Ext.form.FormPanel({
				id : 'byqdetail2',
				region : 'center',
				bodyStyle  : 'padding: 10px; background-color: #DFE8F6',
				method :'POST',
				labelAlign:'right',
				tbar :[
					{
						id :'rz_insert',
						text :'新建',
						cls:'x-btn-text-icon',
        				icon:contextpath + '/images/add.gif',
			            hidden:btn_insert,
        				handler:function() {
        					obj.detail.getForm().reset();
        					obj.detail.getForm().findField("paramByqLqq.baseid").setValue(sbid);
        				}
					}, btn_save ? '' : '-',{
						text:'保存',
						icon:contextpath + "/images/save2.gif",
						hidden:btn_save,
						handler: function() {
        					obj.submit();
        				}
					}
				],
		        items: [
	        	{
					xtype : 'textfield',
					fieldLabel :'设备类型',
    				width: 150,
        			name: 'sblxrd2',
        			id : 'sblxrd2',
					allowBlank : false,
					readOnly : true,
					value     : sblxname,
            		style:'background:#f0f0f0'
        		}, {

					xtype : 'textfield',
					fieldLabel :'冷却器型号',
    				width: 150,
        			name: 'paramByqLqq.xh',
        			id : 'paramByqLqq.xh',
					allowBlank : false,
					maxLength :25
       			}, {
        			xtype : 'numberfield',
    				allowNegative : false,
    				allowDecimals:false,     				
					fieldLabel :'数量（台）',
					width: 150,
        			name: 'paramByqLqq.sl',
        			id : 'paramByqLqq.sl',
					allowBlank : false,
					maxLength :8
       			}, {
        			xtype : 'numberfield',
    				allowNegative : false,
    				allowDecimals:false,
					fieldLabel :'充油量（kg）',
    				width: 150,
        			name: 'paramByqLqq.cyl',
        			id : 'paramByqLqq.cyl',
					allowBlank : false,
					maxLength :8
        		}, {
        			xtype : 'textfield',
					fieldLabel :'进口风温',
    				width: 150,
        			name: 'paramByqLqq.jkfw',
        			id : 'paramByqLqq.jkfw',
					//allowBlank : false,
					maxLength :8
        		}, {
        			xtype : 'textfield',
					fieldLabel :'进口油温',
    				width: 150,
        			name: 'paramByqLqq.jkyw',
        			id : 'paramByqLqq.jkyw',
					//allowBlank : false,
					maxLength :8
       			}, {
        			xtype : 'numberfield',
    				allowNegative : false,
    				allowDecimals:false,
					fieldLabel :'额定风流量',
    				width: 150,
        			name: 'paramByqLqq.edfly',
        			id : 'paramByqLqq.edfly',
					//allowBlank : false,
					maxLength :8
       			}, {
        			xtype : 'numberfield',
    				allowNegative : false,
    				allowDecimals:false,
					fieldLabel :'额定油流量',
    				width: 150,
        			name: 'paramByqLqq.edyly',
        			id : 'paramByqLqq.edyly',
					//allowBlank : false,
					maxLength :8
       			}, {
        			xtype : 'numberfield',
    				allowNegative : false,
    				allowDecimals:false,
					fieldLabel :'重量（kg）',
    				width: 150,
        			name: 'paramByqLqq.zl',
        			id : 'paramByqLqq.zl',
					//allowBlank : false,
					maxLength :8
       			}, {
        			xtype : 'textfield',
					fieldLabel :'出厂序号',
    				width: 150,
        			name: 'paramByqLqq.ccxh',
        			id : 'paramByqLqq.ccxh',
					//allowBlank : false,
					maxLength :25
       			}, {
        			xtype : 'textfield',
					fieldLabel :'制造厂家',
    				width: 150,
        			name: 'paramByqLqq.sccj',
        			id : 'paramByqLqq.sccj',
					//allowBlank : false,
					maxLength :50
       			}, {
        			xtype : 'datefield',
					fieldLabel :'制造时间',
    				width: 150,
        			name: 'paramByqLqq.scrq',
        			id : 'paramByqLqq.scrq',
					//allowBlank : false,
        			editable:false,
        			format:'Y-m-d'
       			}, {
        			xtype : 'textfield',
					fieldLabel :'备注',
    				width: 150,
        			name: 'paramByqLqq.bz',
        			id : 'paramByqLqq.bz',
					//allowBlank : false,
					maxLength :8
        		}, {
        			xtype: 'hidden',
        			name: 'paramByqLqq.id',
        			id:'paramByqLqq.id',
        			value:'0'
        		},{
        			xtype: 'hidden',
        			name: 'paramByqLqq.baseid',
        			id:'paramByqLqq.baseid',
        			value:sbid
        		},{
        			xtype: 'hidden',
        			name: 'sblx',
        			id:'sblx',
        			value:'001-2'
        		},{
        			xtype: 'hidden',
        			name: 'id',
        			id:'id',
        			value:'0'
        		}]
			});

			this.items = [this.grid, this.detail];
			
			business.equipment.byq.Lqq.superclass.initComponent.call(this);

		},

		/**
		 * 提交保存
		 */
		submit: function() {
			
			var obj = this;
			
			// 验证有效性
        	if (this.detail.getForm().isValid()) {
        		
        		// 重新赋值设备ID
        		obj.detail.getForm().findField("paramByqLqq.baseid").setValue(sbid);

				// 提交
				this.detail.getForm().submit({
					waitMsg :'保存中...',
					url:'equip!saveParam.do',
					success : function(form, action) {
						
						Ext.MessageBox.alert('提示', action.result.msg, function() {
						
							if (!Ext.isEmpty(action.result.id)) {
								obj.detail.getForm().findField("paramByqLqq.id").setValue(action.result.id);
								obj.detail.getForm().findField("id").setValue(action.result.id);
								obj.gridstore.baseParams['id'] = sbid;
								obj.gridstore.reload();
							}
						});
					},
					failure : function(action) {
						Ext.MessageBox.alert('提示', '保存失败。');
					}
				});
        	}
			
		},
		
		/**
		 * 删除
		 */
		deleteParam: function() {
			
			var obj = this;
			
			if (!obj.grid.getSelectionModel().hasSelection()) {
				Ext.MessageBox.alert("提示","请先选择要删除的记录");
				return;
			}
			
			var ids = obj.grid.getSelectionModel().getSelected()['data']['id'];
			
			Ext.MessageBox.confirm('提示', '确定要删除选中的记录吗？', function (btn) {
				
				if (btn == 'yes') {

					Ext.Ajax.request({
						method :'POST',
						url :'equip!deleteParam.do?sblx=001-2',
						params : {
							id :ids
						},
						success : function(response) {
							
							Ext.MessageBox.alert('提示', response.responseText, function () {
								obj.grid.store.reload();
							});
						},
						failure : function() {
							Ext.MessageBox.alert('提示', '删除失败！');
						}
					});
				}

			});
			
		},
		
		/**
		 * 获得详细信息
		 */
		getDetail: function() {

			var record = this.grid.getSelectionModel().getSelected()['data'];
			
			for (var p in record) {
				
				try {
					this.detail.getForm().findField("paramByqLqq." + p).setValue(record[p]);
				} catch (e) {
					
				}
				
				this.detail.getForm().findField('id').setValue(record['id']);
			}
		}
	
	});
	
	/**
	 * 储油柜
	 */
	business.equipment.byq.Cyg = Ext.extend(Ext.Panel, {
		
		id 			: '3', 
		title		: '储油柜',
		layout		: 'border',
		
		/**
		 * 绕组参数列表
		 */
		grid : null,
		
		/**
		 * 绕组参数数据源
		 */
		gridstore : null,

		/**
		 * 绕组参数详细信息
		 */
		detail : null,

		/**
	     * 初始化
		 */
		initComponent : function() {
			
			var obj = this;
			
			//----------------------------------------------------------------------
			//	列表数据源
			//----------------------------------------------------------------------
			this.gridstore = new Ext.data.Store({
				proxy :new Ext.data.HttpProxy({
					url :'equip!getParamList.do?sblx=001-3'
				}),
				reader :new Ext.data.JsonReader({
					root :'result',
					totalProperty :'totalCount',
					fields : ['id', 'bdzid', 'xh', 'sccj', 'scrq', 'cc','yzrl','yzmffs']
				}),
				autoLoad:false,
				remoteSort :false
			});
 
			//----------------------------------------------------------------------
			//	加载列表
			//----------------------------------------------------------------------
			this.grid = new Ext.grid.GridPanel({
				id					: "byzgrid3",
				store 				: obj.gridstore,
				region 				: 'west',
				width				: 600,
				stripeRows			: true,
				split				: true,
				collapsible			: true,
				animCollapse		: false,
				cm: new Ext.grid.ColumnModel({
	        		defaults: {
	            		sortable: true
	        		},
	        		columns: [
	        			new Ext.grid.RowNumberer(),
	            		//sm,
						{	id:'id',
							header :"序号",
							width :50,
							dataIndex :'id',
							sortable :true,
							hidden :true
						}, {
							header :"型号",
							width :70,
							dataIndex :'xh',
							sortable :true,
							align:'center'
						}, {
							header :"尺寸",
							width :200,
							dataIndex :'cc',
							sortable :true,
							align:'center'
						},{
							header :"油枕容量",
							width :120,
							dataIndex :'yzrl',
							sortable :true,
							align:'center'
						},{
							header :"生产厂家",
							dataIndex :'sccj',
							sortable :true,
							align:'center'
						}]
				}),
				selModel  : new Ext.grid.RowSelectionModel({singleSelect : true}),
				loadMask : {
					msg :'载入中,请稍候...'
				},
				viewConfig:{
					forceFit:true
				},
				tbar :[
					{
						text :'刷新',
						cls:'x-btn-text-icon',
        				icon:contextpath + '/images/page_find.png',
			            handler:function() {
			            	obj.gridstore.reload();
        				}
					}, btn_delete ? '' : '-',{
						text :'删除',
						cls:'x-btn-text-icon',
        				icon:contextpath + '/images/delete.gif',
        				hidden:btn_delete,
        				handler:function() {
        					obj.deleteParam();
        				}
					}
				],
				bbar : new Ext.PagingToolbar({
					store : obj.gridstore,
					pageSize:100,
					displayInfo :true,
					displayMsg :'共 {2} 条',
					emptyMsg :"没有数据显示！"
				}),
				listeners:{'rowdblclick':function(row) {
					obj.getDetail();
				}}
			});
			
			//----------------------------------------------------------------------
			//	加载详细信息
			//----------------------------------------------------------------------
			this.detail = new Ext.form.FormPanel({
				id : 'byqdetail3',
				region : 'center',
				bodyStyle  : 'padding: 10px; background-color: #DFE8F6',
				method :'POST',
				labelAlign:'right',
				tbar :[
					{
						id :'rz_insert',
						text :'新建',
						cls:'x-btn-text-icon',
        				icon:contextpath + '/images/add.gif',
			            hidden:btn_insert,
        				handler:function() {
        					obj.detail.getForm().reset();
        					obj.detail.getForm().findField("paramByqCyg.baseid").setValue(sbid);
        				}
					}, btn_save ? '' : '-',{
						text:'保存',
						icon:contextpath + "/images/save2.gif",
						hidden:btn_save,
						handler: function() {
        					obj.submit();
        				}
					}
				],
		        items: [
	        	{
					xtype : 'textfield',
					fieldLabel :'设备类型',
    				width: 150,
        			name: 'sblxrd3',
        			id : 'sblxrd3',
					allowBlank : false,
					readOnly : true,
					value     : sblxname,
            		style:'background:#f0f0f0'
        		}, {

					xtype : 'textfield',
					fieldLabel :'型号',
    				width: 150,
        			name: 'paramByqCyg.xh',
        			id : 'paramByqCyg.xh',
					allowBlank : false,
					maxLength :25
       			}, {
        			xtype : 'textfield',       				
					fieldLabel :'生产厂家',
					width: 150,
        			name: 'paramByqCyg.sccj',
        			id : 'paramByqCyg.sccj',
					//allowBlank : false,
					maxLength :50
       			}, {
        			xtype : 'datefield',
					fieldLabel :'生产日期',
    				width: 150,
        			name: 'paramByqCyg.scrq',
        			id : 'paramByqCyg.scrq',
					//allowBlank : false,
					editable   : false,
					format     : 'Y-m-d'
					
        		}, {
        			xtype : 'numberfield',
					fieldLabel :'尺寸',
    				width: 150,
        			name: 'paramByqCyg.cc',
        			id : 'paramByqCyg.cc',
					//allowBlank : false,
					maxLength :8
        		}, {
        			xtype : 'numberfield',
					fieldLabel :'油枕容量',
    				width: 150,
        			name: 'paramByqCyg.yzrl',
        			id : 'paramByqCyg.yzrl',
					//allowBlank : false,
					maxLength :8
        		}, {
					fieldLabel :'油枕密封方式',
					name :'yzmffs',
					id : 'yzmffs',
					xtype : 'combo',
    				width:100,
					hiddenName : 'paramByqCyg.yzmffs',
					store : new Ext.data.Store({
						proxy : new Ext.data.HttpProxy({
							url : 'dic!getDicJson.do?dic.itemType=YZMFFS'
						}),
						reader : new Ext.data.JsonReader({}, ['itemId', 'itemName']),
						autoLoad : true,
						listeners:{'load' : function() {
							var r = new Ext.data.Record({itemId:'', itemName:''});
							Ext.getCmp('yzmffs').store.insert(0,r);
							Ext.getCmp('yzmffs').store.each(function(item) {
								if (item.get('itemId') == Ext.getCmp('yzmffs').getValue()) {
									Ext.getCmp('yzmffs').setRawValue(item.get('itemName'));
								}
							});	
						}}
					}),
					displayField : 'itemName',
					valueField : 'itemId',
					forceSelection : true,
					selectOnFocus : true,
					editable : false,
					triggerAction : 'all',
					mode : 'local',
					emptyText:'请选择'
        		}, {
        			xtype: 'hidden',
        			name: 'paramByqCyg.id',
        			id:'paramByqCyg.id',
        			value:'0'
        		},{
        			xtype: 'hidden',
        			name: 'paramByqCyg.baseid',
        			id:'paramByqCyg.baseid',
        			value:sbid
        		},{
        			xtype: 'hidden',
        			name: 'sblx',
        			id:'sblx',
        			value:'001-3'
        		},{
        			xtype: 'hidden',
        			name: 'id',
        			id:'id',
        			value:'0'
        		}]
			});

			this.items = [this.grid, this.detail];
			
			business.equipment.byq.Cyg.superclass.initComponent.call(this);

		},

		/**
		 * 提交保存
		 */
		submit: function() {
			
			var obj = this;
			
			// 验证有效性
        	if (this.detail.getForm().isValid()) {
        		
        		// 重新赋值设备ID
        		obj.detail.getForm().findField("paramByqCyg.baseid").setValue(sbid);

				// 提交
				this.detail.getForm().submit({
					waitMsg :'保存中...',
					url:'equip!saveParam.do',
					success : function(form, action) {
						
						Ext.MessageBox.alert('提示', action.result.msg, function() {
						
							if (!Ext.isEmpty(action.result.id)) {
								obj.detail.getForm().findField("paramByqCyg.id").setValue(action.result.id);
								obj.detail.getForm().findField("id").setValue(action.result.id);
								obj.gridstore.baseParams['id'] = sbid;
								obj.gridstore.reload();
							}
						});
					},
					failure : function(action) {
						Ext.MessageBox.alert('提示', '保存失败。');
					}
				});
        	}
			
		},
		
		/**
		 * 删除
		 */
		deleteParam: function() {
			
			var obj = this;
			
			if (!obj.grid.getSelectionModel().hasSelection()) {
				Ext.MessageBox.alert("提示","请先选择要删除的记录");
				return;
			}
			
			var ids = obj.grid.getSelectionModel().getSelected()['data']['id'];
			
			Ext.MessageBox.confirm('提示', '确定要删除选中的记录吗？', function (btn) {
				
				if (btn == 'yes') {

					Ext.Ajax.request({
						method :'POST',
						url :'equip!deleteParam.do?sblx=001-3',
						params : {
							id :ids
						},
						success : function(response) {
							
							Ext.MessageBox.alert('提示', response.responseText, function () {
								obj.grid.store.reload();
							});
						},
						failure : function() {
							Ext.MessageBox.alert('提示', '删除失败！');
						}
					});
				}

			});
			
		},
		
		/**
		 * 获得详细信息
		 */
		getDetail: function() {

			var record = this.grid.getSelectionModel().getSelected()['data'];
			
			for (var p in record) {
				
				try {
					this.detail.getForm().findField("paramByqCyg." + p).setValue(record[p]);
				} catch (e) {
					
				}
				
				this.detail.getForm().findField('id').setValue(record['id']);
			}
		}
	
	});

	/**
	 * 压力释放阀
	 */
	business.equipment.byq.Ylsff = Ext.extend(Ext.Panel, {
	
		id 			: '4', 
		title		: '压力释放阀',
		layout		: 'border',
		
		/**
		 * 绕组参数列表
		 */
		grid : null,
		
		/**
		 * 绕组参数数据源
		 */
		gridstore : null,

		/**
		 * 绕组参数详细信息
		 */
		detail : null,

		/**
	     * 初始化
		 */
		initComponent : function() {
			
			var obj = this;
			
			//----------------------------------------------------------------------
			//	列表数据源
			//----------------------------------------------------------------------
			this.gridstore = new Ext.data.Store({
				proxy :new Ext.data.HttpProxy({
					url :'equip!getParamList.do?sblx=001-4'
				}),
				reader :new Ext.data.JsonReader({
					root :'result',
					totalProperty :'totalCount',
					fields : ['id', 'bdzid', 'xh', 'gbyl', 'scxh', 'zl','sl','sccj','scrq','bz']
				}),
				autoLoad:false,
				remoteSort :false
			});

			//----------------------------------------------------------------------
			//	加载列表
			//----------------------------------------------------------------------
			this.grid = new Ext.grid.GridPanel({
				id					: "byzgrid4",
				store 				: obj.gridstore,
				region 				: 'west',
				width				: 600,
				stripeRows			: true,
				split				: true,
				collapsible			: true,
				animCollapse		: false,
				cm: new Ext.grid.ColumnModel({
	        		defaults: {
	            		sortable: true
	        		},
	        		columns: [
	        			new Ext.grid.RowNumberer(),
	            		//sm,
						{	id:'id',
							header :"序号",
							width :50,
							dataIndex :'id',
							sortable :true,
							hidden :true
						}, {
							header :"型号",
							width :70,
							dataIndex :'xh',
							sortable :true,
							align:'center'
						}, {
							header :"关闭压力",
							width :120,
							dataIndex :'gbyl',
							sortable :true,
							align:'center'
						},{
							header :"数量",
							width :120,
							dataIndex :'sl',
							sortable :true,
							align:'center'
						},{
							header :"生产厂家",
							dataIndex :'sccj',
							sortable :true,
							align:'center'
						}]
				}),
				selModel  : new Ext.grid.RowSelectionModel({singleSelect : true}),
				loadMask : {
					msg :'载入中,请稍候...'
				},
				viewConfig:{
					forceFit:true
				},
				tbar :[
					{
						text :'刷新',
						cls:'x-btn-text-icon',
        				icon:contextpath + '/images/page_find.png',
			            handler:function() {
			            	obj.gridstore.reload();
        				}
					}, btn_delete ? '' : '-',{
						text :'删除',
						cls:'x-btn-text-icon',
        				icon:contextpath + '/images/delete.gif',
        				hidden:btn_delete,
        				handler:function() {
        					obj.deleteParam();
        				}
					}
				],
				bbar : new Ext.PagingToolbar({
					store : obj.gridstore,
					pageSize:100,
					displayInfo :true,
					displayMsg :'共 {2} 条',
					emptyMsg :"没有数据显示！"
				}),
				listeners:{'rowdblclick':function(row) {
					obj.getDetail();
				}}
			});
			
			//----------------------------------------------------------------------
			//	加载详细信息
			//----------------------------------------------------------------------
			this.detail = new Ext.form.FormPanel({
				id : 'byqdetail4',
				region : 'center',
				bodyStyle  : 'padding: 10px; background-color: #DFE8F6',
				method :'POST',
				labelAlign:'right',
				tbar :[
					{
						id :'rz_insert',
						text :'新建',
						cls:'x-btn-text-icon',
        				icon:contextpath + '/images/add.gif',
			            hidden:btn_insert,
        				handler:function() {
        					obj.detail.getForm().reset();
        					obj.detail.getForm().findField("paramByqYlsff.baseid").setValue(sbid);
        				}
					}, btn_save ? '' : '-',{
						text:'保存',
						icon:contextpath + "/images/save2.gif",
						hidden:btn_save,
						handler: function() {
        					obj.submit();
        				}
					}
				],
		        items: [
	        	{
					xtype : 'textfield',
					fieldLabel :'设备类型',
    				width: 150,
        			name: 'sblxrd4',
        			id : 'sblxrd4',
					allowBlank : false,
					readOnly : true,
					value     : sblxname,
            		style:'background:#f0f0f0'
        		}, {

					xtype : 'textfield',
					fieldLabel :'型号',
    				width: 150,
        			name: 'paramByqYlsff.xh',
        			id : 'paramByqYlsff.xh',
					allowBlank : false,
					maxLength :25
       			}, {
        			xtype : 'numberfield',
    				allowNegative : false,
    				allowDecimals:false,       				
					fieldLabel :'关闭压力（kPa）',
					width: 150,
        			name: 'paramByqYlsff.gbyl',
        			id : 'paramByqYlsff.gbyl',
					allowBlank : false,
					maxLength :8
       			}, {
        			xtype : 'textfield',
    				allowNegative : false,
    				allowDecimals:false,
					fieldLabel :'生产序号',
    				width: 150,
        			name: 'paramByqYlsff.scxh',
        			id : 'paramByqYlsff.scxh',
					//allowBlank : false,
					maxLength :25
        		}, {
        			xtype : 'numberfield',
    				allowNegative : false,
    				allowDecimals:false,
					fieldLabel :'重量（kg）',
    				width: 150,
        			name: 'paramByqYlsff.zl',
        			id : 'paramByqYlsff.zl',
					//allowBlank : false,
					maxLength :8
       			}, {
        			xtype : 'textfield',       				
					fieldLabel :'生产厂家',
					width: 150,
        			name: 'paramByqYlsff.sccj',
        			id : 'paramByqYlsff.sccj',
					//allowBlank : false,
					maxLength :50
       			}, {
        			xtype : 'datefield',
					fieldLabel :'生产日期',
    				width: 150,
        			name: 'paramByqYlsff.scrq',
        			id : 'paramByqYlsff.scrq',
					//allowBlank : false,
					editable   : false,
					format     : 'Y-m-d'
        		}, {
        			xtype : 'numberfield',
    				allowNegative : false,
    				allowDecimals:false,
					fieldLabel :'数量',
    				width: 150,
        			name: 'paramByqYlsff.sl',
        			id : 'paramByqYlsff.sl',
					//allowBlank : false,
					maxLength :8
       			}, {
        			xtype : 'textfield',       				
					fieldLabel :'备注',
					width: 150,
        			name: 'paramByqYlsff.bz',
        			id : 'paramByqYlsff.bz',
					//allowBlank : false,
					maxLength :50
       			}, {
        			xtype: 'hidden',
        			name: 'paramByqYlsff.id',
        			id:'paramByqYlsff.id',
        			value:'0'
        		},{
        			xtype: 'hidden',
        			name: 'paramByqYlsff.baseid',
        			id:'paramByqYlsff.baseid',
        			value:sbid
        		},{
        			xtype: 'hidden',
        			name: 'sblx',
        			id:'sblx',
        			value:'001-4'
        		},{
        			xtype: 'hidden',
        			name: 'id',
        			id:'id',
        			value:'0'
        		}]
			});

			this.items = [this.grid, this.detail];
			
			business.equipment.byq.Ylsff.superclass.initComponent.call(this);

		},

		/**
		 * 提交保存
		 */
		submit: function() {
			
			var obj = this;
			
			// 验证有效性
        	if (this.detail.getForm().isValid()) {
        		
        		// 重新赋值设备ID
        		obj.detail.getForm().findField("paramByqYlsff.baseid").setValue(sbid);

				// 提交
				this.detail.getForm().submit({
					waitMsg :'保存中...',
					url:'equip!saveParam.do',
					success : function(form, action) {
						
						Ext.MessageBox.alert('提示', action.result.msg, function() {
						
							if (!Ext.isEmpty(action.result.id)) {
								obj.detail.getForm().findField("paramByqYlsff.id").setValue(action.result.id);
								obj.detail.getForm().findField("id").setValue(action.result.id);
								obj.gridstore.baseParams['id'] = sbid;
								obj.gridstore.reload();
							}
						});
					},
					failure : function(action) {
						Ext.MessageBox.alert('提示', '保存失败。');
					}
				});
        	}
			
		},
		
		/**
		 * 删除
		 */
		deleteParam: function() {
			
			var obj = this;
			
			if (!obj.grid.getSelectionModel().hasSelection()) {
				Ext.MessageBox.alert("提示","请先选择要删除的记录");
				return;
			}
			
			var ids = obj.grid.getSelectionModel().getSelected()['data']['id'];
			
			Ext.MessageBox.confirm('提示', '确定要删除选中的记录吗？', function (btn) {
				
				if (btn == 'yes') {

					Ext.Ajax.request({
						method :'POST',
						url :'equip!deleteParam.do?sblx=001-4',
						params : {
							id :ids
						},
						success : function(response) {
							
							Ext.MessageBox.alert('提示', response.responseText, function () {
								obj.grid.store.reload();
							});
						},
						failure : function() {
							Ext.MessageBox.alert('提示', '删除失败！');
						}
					});
				}

			});
			
		},
		
		/**
		 * 获得详细信息
		 */
		getDetail: function() {

			var record = this.grid.getSelectionModel().getSelected()['data'];
			
			for (var p in record) {
				
				try {
					this.detail.getForm().findField("paramByqYlsff." + p).setValue(record[p]);
				} catch (e) {
					
				}
				
				this.detail.getForm().findField('id').setValue(record['id']);
			}
		}
	
	});
	
	/**
	 * 有载开关气体继电器  5
	 */
	business.equipment.byq.Yzjdq = Ext.extend(Ext.Panel, {
		
		id 			: '5', 
		title		: '有载开关气体继电器',
		layout		: 'border',
		/**
		 * 绕组参数列表
		 */
		grid : null,
		
		/**
		 * 绕组参数数据源
		 */
		gridstore : null,

		/**
		 * 绕组参数详细信息
		 */
		detail : null,

		/**
	     * 初始化
		 */
		initComponent : function() {
			
			var obj = this;
			
			//----------------------------------------------------------------------
			//	列表数据源
			//----------------------------------------------------------------------
			this.gridstore = new Ext.data.Store({
				proxy :new Ext.data.HttpProxy({
					url :'equip!getParamList.do?sblx=001-5'
				}),
				reader :new Ext.data.JsonReader({
					root :'result',
					totalProperty :'totalCount',
					fields : ['id', 'bdzid', 'xh', 'rjzdz', 'lszdz', 'sccj','scrq','bz']
				}),
				autoLoad:false,
				remoteSort :false
			});

			//----------------------------------------------------------------------
			//	加载列表
			//----------------------------------------------------------------------
			this.grid = new Ext.grid.GridPanel({
				id					: "byzgrid5",
				store 				: obj.gridstore,
				region 				: 'west',
				width				: 600,
				stripeRows			: true,
				split				: true,
				collapsible			: true,
				animCollapse		: false,
				cm: new Ext.grid.ColumnModel({
	        		defaults: {
	            		sortable: true
	        		},
	        		columns: [
	        			new Ext.grid.RowNumberer(),
	            		//sm,
						{	id:'id',
							header :"序号",
							width :50,
							dataIndex :'id',
							sortable :true,
							hidden :true
						}, {
							header :"型号",
							width :70,
							dataIndex :'xh',
							sortable :true,
							align:'center'
						}, {
							header :"容积整定值",
							width :200,
							dataIndex :'rjzdz',
							sortable :true,
							align:'center'
						},{
							header :"流速整定值",
							width :120,
							dataIndex :'lszdz',
							sortable :true,
							align:'center'
						},{
							header :"生产厂家",
							dataIndex :'sccj',
							sortable :true,
							align:'center'
						}]
				}),
				selModel  : new Ext.grid.RowSelectionModel({singleSelect : true}),
				loadMask : {
					msg :'载入中,请稍候...'
				},
				viewConfig:{
					forceFit:true
				},
				tbar :[
					{
						text :'刷新',
						cls:'x-btn-text-icon',
        				icon:contextpath + '/images/page_find.png',
			            handler:function() {
			            	obj.gridstore.reload();
        				}
					}, btn_delete ? '' : '-',{
						text :'删除',
						cls:'x-btn-text-icon',
        				icon:contextpath + '/images/delete.gif',
        				hidden:btn_delete,
        				handler:function() {
        					obj.deleteParam();
        				}
					}
				],
				bbar : new Ext.PagingToolbar({
					store : obj.gridstore,
					pageSize:100,
					displayInfo :true,
					displayMsg :'共 {2} 条',
					emptyMsg :"没有数据显示！"
				}),
				listeners:{'rowdblclick':function(row) {
					obj.getDetail();
				}}
			});
			
			//----------------------------------------------------------------------
			//	加载详细信息
			//----------------------------------------------------------------------
			this.detail = new Ext.form.FormPanel({
				id : 'byqdetail5',
				region : 'center',
				bodyStyle  : 'padding: 10px; background-color: #DFE8F6',
				method :'POST',
				labelAlign:'right',
				labelWidth : 115,
				tbar :[
					{
						id :'rz_insert',
						text :'新建',
						cls:'x-btn-text-icon',
        				icon:contextpath + '/images/add.gif',
			            hidden:btn_insert,
        				handler:function() {
        					obj.detail.getForm().reset();
        					obj.detail.getForm().findField("paramByqYzjdq.baseid").setValue(sbid);
        				}
					}, btn_save ? '' : '-',{
						text:'保存',
						icon:contextpath + "/images/save2.gif",
						hidden:btn_save,
						handler: function() {
        					obj.submit();
        				}
					}
				],	
		        items: [
	        	{
					xtype : 'textfield',
					fieldLabel :'设备类型',
    				width: 150,
        			name: 'sblxrd5',
        			id : 'sblxrd5',
					allowBlank : false,
					readOnly : true,
					value     : sblxname
        		}, {
					xtype : 'textfield',
					fieldLabel :'型号',
    				width: 150,
        			name: 'paramByqYzjdq.xh',
        			id : 'paramByqYzjdq.xh',
					allowBlank : false,
					maxLength :25
       			}, {
        			xtype : 'datefield',       				
					fieldLabel :'生产日期',
					width: 150,
        			name: 'paramByqYzjdq.scrq',
        			id : 'paramByqYzjdq.scrq',
					//allowBlank : false,
            		editable:false,
            		format:'Y-m-d'
        		}, {
        			xtype : 'textfield',
					fieldLabel :'制造厂家',
    				width: 150,
        			name: 'paramByqYzjdq.sccj',
        			id : 'paramByqYzjdq.sccj',
					//allowBlank : false,
					maxLength :50
        		}, {
        			xtype : 'numberfield',
    				allowNegative : false,
    				allowDecimals:false,
					fieldLabel :'容积整定值（cm3）',
    				width: 150,
        			name: 'paramByqYzjdq.rjzdz',
        			id : 'paramByqYzjdq.rjzdz',
					//allowBlank : false,
					maxLength :8
        		}, {
        			xtype : 'numberfield',
    				allowNegative : false,
    				allowDecimals:false,
					fieldLabel :'流速整定值（m/s）',
    				width: 150,
        			name: 'paramByqYzjdq.lszdz',
        			id : 'paramByqYzjdq.lszdz',
					//allowBlank : false,
					maxLength :8
        		}, {
        			xtype : 'textfield',
					fieldLabel :'备注',
    				width: 150,
        			name: 'paramByqYzjdq.bz',
        			id : 'paramByqYzjdq.bz',
					//allowBlank : false,
					maxLength :50
        		}, {
        			xtype: 'hidden',
        			name: 'paramByqYzjdq.id',
        			id:'paramByqYzjdq.id',
        			value:'0'
        		},{
        			xtype: 'hidden',
        			name: 'paramByqYzjdq.baseid',
        			id:'paramByqYzjdq.baseid',
        			value:sbid
        		},{
        			xtype: 'hidden',
        			name: 'sblx',
        			id:'sblx',
        			value:'001-5'
        		},{
        			xtype: 'hidden',
        			name: 'id',
        			id:'id',
        			value:'0'
        		}]
			});

			this.items = [this.grid, this.detail];
			
			business.equipment.byq.Yzjdq.superclass.initComponent.call(this);

		},

		/**
		 * 提交保存
		 */
		submit: function() {
			
			var obj = this;
			
			// 验证有效性
        	if (this.detail.getForm().isValid()) {
        		
        		// 重新赋值设备ID
        		obj.detail.getForm().findField("paramByqYzjdq.baseid").setValue(sbid);

				// 提交
				this.detail.getForm().submit({
					waitMsg :'保存中...',
					url:'equip!saveParam.do',
					success : function(form, action) {
						
						Ext.MessageBox.alert('提示', action.result.msg, function() {
						
							if (!Ext.isEmpty(action.result.id)) {
								obj.detail.getForm().findField("paramByqYzjdq.id").setValue(action.result.id);
								obj.detail.getForm().findField("id").setValue(action.result.id);
								obj.gridstore.baseParams['id'] = sbid;
								obj.gridstore.reload();
							}
						});
					},
					failure : function(action) {
						Ext.MessageBox.alert('提示', '保存失败。');
					}
				});
        	}
			
		},
		
		/**
		 * 删除
		 */
		deleteParam: function() {
			
			var obj = this;
			
			if (!obj.grid.getSelectionModel().hasSelection()) {
				Ext.MessageBox.alert("提示","请先选择要删除的记录");
				return;
			}
			
			var ids = obj.grid.getSelectionModel().getSelected()['data']['id'];
			
			Ext.MessageBox.confirm('提示', '确定要删除选中的记录吗？', function (btn) {
				
				if (btn == 'yes') {

					Ext.Ajax.request({
						method :'POST',
						url :'equip!deleteParam.do?sblx=001-5',
						params : {
							id :ids
						},
						success : function(response) {
							
							Ext.MessageBox.alert('提示', response.responseText, function () {
								obj.grid.store.reload();
							});
						},
						failure : function() {
							Ext.MessageBox.alert('提示', '删除失败！');
						}
					});
				}

			});
			
		},
		
		/**
		 * 获得详细信息
		 */
		getDetail: function() {

			var record = this.grid.getSelectionModel().getSelected()['data'];
			
			for (var p in record) {
				
				try {
					this.detail.getForm().findField("paramByqYzjdq." + p).setValue(record[p]);
				} catch (e) {
					
				}
				
				this.detail.getForm().findField('id').setValue(record['id']);
			}
		}
	
	});

	/**
	 * 本体气体继电器
	 */
	business.equipment.byq.Btqtjdq = Ext.extend(Ext.Panel, {
		
		id 			: '6', 
		title		: '本体气体继电器',
		layout		: 'border',

		/**
		 * 绕组参数列表
		 */
		grid : null,
		
		/**
		 * 绕组参数数据源
		 */
		gridstore : null,

		/**
		 * 绕组参数详细信息
		 */
		detail : null,

		/**
	     * 初始化
		 */
		initComponent : function() {
			
			var obj = this;
			
			//----------------------------------------------------------------------
			//	列表数据源
			//----------------------------------------------------------------------
			this.gridstore = new Ext.data.Store({
				proxy :new Ext.data.HttpProxy({
					url :'equip!getParamList.do?sblx=001-6'
				}),
				reader :new Ext.data.JsonReader({
					root :'result',
					totalProperty :'totalCount',
					fields : ['id', 'bdzid', 'xh', 'rjzdz', 'lszdz', 'sccj','scrq','bz']
				}),
				autoLoad:false,
				remoteSort :false
			});

			//----------------------------------------------------------------------
			//	加载列表
			//----------------------------------------------------------------------
			this.grid = new Ext.grid.GridPanel({
				id					: "byzgrid6",
				store 				: obj.gridstore,
				region 				: 'west',
				width				: 600,
				stripeRows			: true,
				split				: true,
				collapsible			: true,
				animCollapse		: false,
				cm: new Ext.grid.ColumnModel({
	        		defaults: {
	            		sortable: true
	        		},
	        		columns: [
	        			new Ext.grid.RowNumberer(),
	            		//sm,
						{	id:'id',
							header :"序号",
							width :50,
							dataIndex :'id',
							sortable :true,
							hidden :true
						}, {
							header :"型号",
							width :70,
							dataIndex :'xh',
							sortable :true,
							align:'center'
						}, {
							header :"容积整定值",
							width :200,
							dataIndex :'rjzdz',
							sortable :true,
							align:'center'
						},{
							header :"流速整定值",
							width :120,
							dataIndex :'lszdz',
							sortable :true,
							align:'center'
						},{
							header :"生产厂家",
							dataIndex :'sccj',
							sortable :true,
							align:'center'
						}]
				}),
				selModel  : new Ext.grid.RowSelectionModel({singleSelect : true}),
				loadMask : {
					msg :'载入中,请稍候...'
				},
				viewConfig:{
					forceFit:true
				},
				tbar :[
					{
						text :'刷新',
						cls:'x-btn-text-icon',
        				icon:contextpath + '/images/page_find.png',
			            handler:function() {
			            	obj.gridstore.reload();
        				}
					}, btn_delete ? '' : '-',{
						text :'删除',
						cls:'x-btn-text-icon',
        				icon:contextpath + '/images/delete.gif',
        				hidden:btn_delete,
        				handler:function() {
        					obj.deleteParam();
        				}
					}
				],
				bbar : new Ext.PagingToolbar({
					store : obj.gridstore,
					pageSize:100,
					displayInfo :true,
					displayMsg :'共 {2} 条',
					emptyMsg :"没有数据显示！"
				}),
				listeners:{'rowdblclick':function(row) {
					obj.getDetail();
				}}
			});
			
			//----------------------------------------------------------------------
			//	加载详细信息
			//----------------------------------------------------------------------
			this.detail = new Ext.form.FormPanel({
				id : 'byqdetail6',
				region : 'center',
				bodyStyle  : 'padding: 10px; background-color: #DFE8F6',
				method :'POST',
				labelAlign:'right',
				labelWidth : 115,
				tbar :[
					{
						id :'rz_insert',
						text :'新建',
						cls:'x-btn-text-icon',
        				icon:contextpath + '/images/add.gif',
			            hidden:btn_insert,
        				handler:function() {
        					obj.detail.getForm().reset();
        					obj.detail.getForm().findField("paramByqYzjdq.baseid").setValue(sbid);
        				}
					}, btn_save ? '' : '-',{
						text:'保存',
						icon:contextpath + "/images/save2.gif",
						hidden:btn_save,
						handler: function() {
        					obj.submit();
        				}
					}
				],	
		        items: [
	        	{
					xtype : 'textfield',
					fieldLabel :'设备类型',
    				width: 150,
        			name: 'sblxrd6',
        			id : 'sblxrd6',
					allowBlank : false,
					readOnly : true,
					value     : sblxname
        		}, {
					xtype : 'textfield',
					fieldLabel :'型号',
    				width: 150,
        			name: 'paramByqBtqtjdq.xh',
        			id : 'paramByqBtqtjdq.xh',
					allowBlank : false,
					maxLength :25
       			}, {
        			xtype : 'datefield',       				
					fieldLabel :'生产日期',
					width: 150,
        			name: 'paramByqBtqtjdq.scrq',
        			id : 'paramByqBtqtjdq.scrq',
					//allowBlank : false,
            		editable:false,
            		format:'Y-m-d'
        		}, {
        			xtype : 'textfield',
					fieldLabel :'制造厂家',
    				width: 150,
        			name: 'paramByqBtqtjdq.sccj',
        			id : 'paramByqBtqtjdq.sccj',
					//allowBlank : false,
					maxLength :50
        		}, {
        			xtype : 'numberfield',
    				allowNegative : false,
    				allowDecimals:false,
					fieldLabel :'容积整定值（cm3）',
    				width: 150,
        			name: 'paramByqBtqtjdq.rjzdz',
        			id : 'paramByqBtqtjdq.rjzdz',
					//allowBlank : false,
					maxLength :8
        		}, {
        			xtype : 'numberfield',
    				allowNegative : false,
    				allowDecimals:false,
					fieldLabel :'流速整定值（m/s）',
    				width: 150,
        			name: 'paramByqBtqtjdq.lszdz',
        			id : 'paramByqBtqtjdq.lszdz',
					//allowBlank : false,
					maxLength :8
        		}, {
        			xtype : 'textfield',
					fieldLabel :'备注',
    				width: 150,
        			name: 'paramByqBtqtjdq.bz',
        			id : 'paramByqBtqtjdq.bz',
					//allowBlank : false,
					maxLength :50
        		}, {
        			xtype: 'hidden',
        			name: 'paramByqBtqtjdq.id',
        			id:'paramByqBtqtjdq.id',
        			value:'0'
        		},{
        			xtype: 'hidden',
        			name: 'paramByqBtqtjdq.baseid',
        			id:'paramByqBtqtjdq.baseid',
        			value:sbid
        		},{
        			xtype: 'hidden',
        			name: 'sblx',
        			id:'sblx',
        			value:'001-6'
        		},{
        			xtype: 'hidden',
        			name: 'id',
        			id:'id',
        			value:'0'
        		}]
			});

			this.items = [this.grid, this.detail];
			
			business.equipment.byq.Btqtjdq.superclass.initComponent.call(this);

		},

		/**
		 * 提交保存
		 */
		submit: function() {
			
			var obj = this;
			
			// 验证有效性
        	if (this.detail.getForm().isValid()) {
        		
        		// 重新赋值设备ID
        		obj.detail.getForm().findField("paramByqBtqtjdq.baseid").setValue(sbid);

				// 提交
				this.detail.getForm().submit({
					waitMsg :'保存中...',
					url:'equip!saveParam.do',
					success : function(form, action) {
						
						Ext.MessageBox.alert('提示', action.result.msg, function() {
						
							if (!Ext.isEmpty(action.result.id)) {
								obj.detail.getForm().findField("paramByqBtqtjdq.id").setValue(action.result.id);
								obj.detail.getForm().findField("id").setValue(action.result.id);
								obj.gridstore.baseParams['id'] = sbid;
								obj.gridstore.reload();
							}
						});
					},
					failure : function(action) {
						Ext.MessageBox.alert('提示', '保存失败。');
					}
				});
        	}
			
		},
		
		/**
		 * 删除
		 */
		deleteParam: function() {
			
			var obj = this;
			
			if (!obj.grid.getSelectionModel().hasSelection()) {
				Ext.MessageBox.alert("提示","请先选择要删除的记录");
				return;
			}
			
			var ids = obj.grid.getSelectionModel().getSelected()['data']['id'];
			
			Ext.MessageBox.confirm('提示', '确定要删除选中的记录吗？', function (btn) {
				
				if (btn == 'yes') {

					Ext.Ajax.request({
						method :'POST',
						url :'equip!deleteParam.do?sblx=001-6',
						params : {
							id :ids
						},
						success : function(response) {
							
							Ext.MessageBox.alert('提示', response.responseText, function () {
								obj.grid.store.reload();
							});
						},
						failure : function() {
							Ext.MessageBox.alert('提示', '删除失败！');
						}
					});
				}

			});
			
		},
		
		/**
		 * 获得详细信息
		 */
		getDetail: function() {

			var record = this.grid.getSelectionModel().getSelected()['data'];
			
			for (var p in record) {
				
				try {
					this.detail.getForm().findField("paramByqBtqtjdq." + p).setValue(record[p]);
				} catch (e) {
					
				}
				
				this.detail.getForm().findField('id').setValue(record['id']);
			}
		}
	
	});

	/**
	 * 油流继电器
	 */
	business.equipment.byq.Yljdq = Ext.extend(Ext.Panel, {
		
		id 			: '7', 
		title		: '油流继电器',
		layout		: 'border',
		
		/**
		 * 绕组参数列表
		 */
		grid : null,
		
		/**
		 * 绕组参数数据源
		 */
		gridstore : null,

		/**
		 * 绕组参数详细信息
		 */
		detail : null,

		/**
	     * 初始化
		 */
		initComponent : function() {
			
			var obj = this;
			
			//----------------------------------------------------------------------
			//	列表数据源
			//----------------------------------------------------------------------
			this.gridstore = new Ext.data.Store({
				proxy :new Ext.data.HttpProxy({
					url :'equip!getParamList.do?sblx=001-7'
				}),
				reader :new Ext.data.JsonReader({
					root :'result',
					totalProperty :'totalCount',
					fields : ['id', 'bdzid', 'xh', 'sl', 'sccj','scrq','bz']
				}),
				autoLoad:false,
				remoteSort :false
			});

			//----------------------------------------------------------------------
			//	加载列表
			//----------------------------------------------------------------------
			this.grid = new Ext.grid.GridPanel({
				id					: "byzgrid7",
				store 				: obj.gridstore,
				region 				: 'west',
				width				: 600,
				stripeRows			: true,
				split				: true,
				collapsible			: true,
				animCollapse		: false,
				cm: new Ext.grid.ColumnModel({
	        		defaults: {
	            		sortable: true
	        		},
	        		columns: [
	        			new Ext.grid.RowNumberer(),
	            		//sm,
						{	id:'id',
							header :"序号",
							width :50,
							dataIndex :'id',
							sortable :true,
							hidden :true
						}, {
							header :"型号",
							width :70,
							dataIndex :'xh',
							sortable :true,
							align:'center'
						}, {
							header :"数量",
							width :100,
							dataIndex :'sl',
							sortable :true,
							align:'center'
						},{
							header :"生产厂家",
							dataIndex :'sccj',
							sortable :true,
							align:'center'
						}]
				}),
				selModel  : new Ext.grid.RowSelectionModel({singleSelect : true}),
				loadMask : {
					msg :'载入中,请稍候...'
				},
				viewConfig:{
					forceFit:true
				},
				tbar :[
					{
						text :'刷新',
						cls:'x-btn-text-icon',
        				icon:contextpath + '/images/page_find.png',
			            handler:function() {
			            	obj.gridstore.reload();
        				}
					}, btn_delete ? '' : '-',{
						text :'删除',
						cls:'x-btn-text-icon',
        				icon:contextpath + '/images/delete.gif',
        				hidden:btn_delete,
        				handler:function() {
        					obj.deleteParam();
        				}
					}
				],
				bbar : new Ext.PagingToolbar({
					store : obj.gridstore,
					pageSize:100,
					displayInfo :true,
					displayMsg :'共 {2} 条',
					emptyMsg :"没有数据显示！"
				}),
				listeners:{'rowdblclick':function(row) {
					obj.getDetail();
				}}
			});
			
			//----------------------------------------------------------------------
			//	加载详细信息
			//----------------------------------------------------------------------
			this.detail = new Ext.form.FormPanel({
				id : 'byqdetail7',
				region : 'center',
				bodyStyle  : 'padding: 10px; background-color: #DFE8F6',
				method :'POST',
				labelAlign:'right',
				labelWidth : 115,
				tbar :[
					{
						id :'rz_insert',
						text :'新建',
						cls:'x-btn-text-icon',
        				icon:contextpath + '/images/add.gif',
			            hidden:btn_insert,
        				handler:function() {
        					obj.detail.getForm().reset();
        					obj.detail.getForm().findField("paramByqYzjdq.baseid").setValue(sbid);
        				}
					}, btn_save ? '' : '-',{
						text:'保存',
						icon:contextpath + "/images/save2.gif",
						hidden:btn_save,
						handler: function() {
        					obj.submit();
        				}
					}
				],	
		        items: [
	        	{
					xtype : 'textfield',
					fieldLabel :'设备类型',
    				width: 150,
        			name: 'sblxrd7',
        			id : 'sblxrd7',
					allowBlank : false,
					readOnly : true,
					value     : sblxname
        		}, {
					xtype : 'textfield',
					fieldLabel :'型号',
    				width: 150,
        			name: 'paramByqYljdq.xh',
        			id : 'paramByqYljdq.xh',
					allowBlank : false,
					maxLength :25
       			}, {
        			xtype : 'datefield',       				
					fieldLabel :'生产日期',
					width: 150,
        			name: 'paramByqYljdq.scrq',
        			id : 'paramByqYljdq.scrq',
					//allowBlank : false,
            		editable:false,
            		format:'Y-m-d'
        		}, {
        			xtype : 'textfield',
					fieldLabel :'制造厂家',
    				width: 150,
        			name: 'paramByqYljdq.sccj',
        			id : 'paramByqYljdq.sccj',
					//allowBlank : false,
					maxLength :50
        		}, {
        			xtype : 'numberfield',
    				allowNegative : false,
    				allowDecimals:false,
					fieldLabel :'数量',
    				width: 150,
        			name: 'paramByqYljdq.sl',
        			id : 'paramByqYljdq.sl',
					//allowBlank : false,
					maxLength :8
        		}, {
        			xtype : 'textfield',
					fieldLabel :'备注',
    				width: 150,
        			name: 'paramByqYljdq.bz',
        			id : 'paramByqYljdq.bz',
					//allowBlank : false,
					maxLength :50
        		}, {
        			xtype: 'hidden',
        			name: 'paramByqYljdq.id',
        			id:'paramByqYljdq.id',
        			value:'0'
        		},{
        			xtype: 'hidden',
        			name: 'paramByqYljdq.baseid',
        			id:'paramByqYljdq.baseid',
        			value:sbid
        		},{
        			xtype: 'hidden',
        			name: 'sblx',
        			id:'sblx',
        			value:'001-7'
        		},{
        			xtype: 'hidden',
        			name: 'id',
        			id:'id',
        			value:'0'
        		}]
			});

			this.items = [this.grid, this.detail];
			
			business.equipment.byq.Yljdq.superclass.initComponent.call(this);

		},

		/**
		 * 提交保存
		 */
		submit: function() {
			
			var obj = this;
			
			// 验证有效性
        	if (this.detail.getForm().isValid()) {
        		
        		// 重新赋值设备ID
        		obj.detail.getForm().findField("paramByqYljdq.baseid").setValue(sbid);

				// 提交
				this.detail.getForm().submit({
					waitMsg :'保存中...',
					url:'equip!saveParam.do',
					success : function(form, action) {
						
						Ext.MessageBox.alert('提示', action.result.msg, function() {
						
							if (!Ext.isEmpty(action.result.id)) {
								obj.detail.getForm().findField("paramByqYljdq.id").setValue(action.result.id);
								obj.detail.getForm().findField("id").setValue(action.result.id);
								obj.gridstore.baseParams['id'] = sbid;
								obj.gridstore.reload();
							}
						});
					},
					failure : function(action) {
						Ext.MessageBox.alert('提示', '保存失败。');
					}
				});
        	}
		},
		
		/**
		 * 删除
		 */
		deleteParam: function() {
			
			var obj = this;
			
			if (!obj.grid.getSelectionModel().hasSelection()) {
				Ext.MessageBox.alert("提示","请先选择要删除的记录");
				return;
			}
			
			var ids = obj.grid.getSelectionModel().getSelected()['data']['id'];
			
			Ext.MessageBox.confirm('提示', '确定要删除选中的记录吗？', function (btn) {
				
				if (btn == 'yes') {

					Ext.Ajax.request({
						method :'POST',
						url :'equip!deleteParam.do?sblx=001-7',
						params : {
							id :ids
						},
						success : function(response) {
							
							Ext.MessageBox.alert('提示', response.responseText, function () {
								obj.grid.store.reload();
							});
						},
						failure : function() {
							Ext.MessageBox.alert('提示', '删除失败！');
						}
					});
				}

			});
			
		},
		
		/**
		 * 获得详细信息
		 */
		getDetail: function() {

			var record = this.grid.getSelectionModel().getSelected()['data'];
			
			for (var p in record) {
				
				try {
					this.detail.getForm().findField("paramByqYljdq." + p).setValue(record[p]);
				} catch (e) {
					
				}
				
				this.detail.getForm().findField('id').setValue(record['id']);
			}
		}
	
	});

	/**
	 * 潜油泵
	 */
	business.equipment.byq.Qyb = Ext.extend(Ext.Panel, {
		
		id 			: '8', 
		title		: '潜油泵',
		layout		: 'border',
		
		/**
		 * 绕组参数列表
		 */
		grid : null,
		
		/**
		 * 绕组参数数据源
		 */
		gridstore : null,

		/**
		 * 绕组参数详细信息
		 */
		detail : null,

		/**
	     * 初始化
		 */
		initComponent : function() {
			
			var obj = this;
			
			//----------------------------------------------------------------------
			//	列表数据源
			//----------------------------------------------------------------------
			this.gridstore = new Ext.data.Store({
				proxy :new Ext.data.HttpProxy({
					url :'equip!getParamList.do?sblx=001-8'
				}),
				reader :new Ext.data.JsonReader({
					root :'result',
					totalProperty :'totalCount',
					fields : ['id', 'bdzid', 'xh', 'scxh', 'sccj', 'scrq','bz','dy','gl','ll','yc','zs','sl']
				}),
				autoLoad:false,
				remoteSort :false
			});

			//----------------------------------------------------------------------
			//	加载列表
			//----------------------------------------------------------------------
			this.grid = new Ext.grid.GridPanel({
				id					: "byzgrid8",
				store 				: obj.gridstore,
				region 				: 'west',
				width				: 600,
				stripeRows			: true,
				split				: true,
				collapsible			: true,
				animCollapse		: false,
				cm: new Ext.grid.ColumnModel({
	        		defaults: {
	            		sortable: true
	        		},
	        		columns: [
	        			new Ext.grid.RowNumberer(),
	            		//sm,
						{	id:'id',
							header :"序号",
							width :50,
							dataIndex :'id',
							sortable :true,
							hidden :true
						}, {
							header :"型号",
							width :70,
							dataIndex :'xh',
							sortable :true,
							align:'center'
						}, {
							header :"生产序号",
							width :120,
							dataIndex :'scxh',
							sortable :true,
							align:'center'
						},{
							header :"数量",
							width :120,
							dataIndex :'sl',
							sortable :true,
							align:'center'
						},{
							header :"厂家",
							dataIndex :'sccj',
							sortable :true,
							align:'center'
						}]
				}),
				selModel  : new Ext.grid.RowSelectionModel({singleSelect : true}),
				loadMask : {
					msg :'载入中,请稍候...'
				},
				viewConfig:{
					forceFit:true
				},
				tbar :[
					{
						text :'刷新',
						cls:'x-btn-text-icon',
        				icon:contextpath + '/images/page_find.png',
			            handler:function() {
			            	obj.gridstore.reload();
        				}
					}, btn_delete ? '' : '-',{
						text :'删除',
						cls:'x-btn-text-icon',
        				icon:contextpath + '/images/delete.gif',
        				hidden:btn_delete,
        				handler:function() {
        					obj.deleteParam();
        				}
					}
				],
				bbar : new Ext.PagingToolbar({
					store : obj.gridstore,
					pageSize:100,
					displayInfo :true,
					displayMsg :'共 {2} 条',
					emptyMsg :"没有数据显示！"
				}),
				listeners:{'rowdblclick':function(row) {
					obj.getDetail();
				}}
			});
			
			//----------------------------------------------------------------------
			//	加载详细信息
			//----------------------------------------------------------------------
			this.detail = new Ext.form.FormPanel({
				id : 'byqdetail8',
				region : 'center',
				bodyStyle  : 'padding: 10px; background-color: #DFE8F6',
				method :'POST',
				labelAlign:'right',
				tbar :[
					{
						id :'rz_insert',
						text :'新建',
						cls:'x-btn-text-icon',
        				icon:contextpath + '/images/add.gif',
			            hidden:btn_insert,
        				handler:function() {
        					obj.detail.getForm().reset();
        					obj.detail.getForm().findField("paramByqQyb.baseid").setValue(sbid);
        				}
					}, btn_save ? '' : '-',{
						text:'保存',
						icon:contextpath + "/images/save2.gif",
						hidden:btn_save,
						handler: function() {
        					obj.submit();
        				}
					}
				],
		        items: [
	        	{
					xtype : 'textfield',
					fieldLabel :'设备类型',
    				width: 150,
        			name: 'sblxrd8',
        			id : 'sblxrd8',
					allowBlank : false,
					readOnly : true,
					value     : sblxname
        		}, {
					xtype : 'textfield',
					fieldLabel :'型号',
    				width: 150,
        			name: 'paramByqQyb.xh',
        			id : 'paramByqQyb.xh',
					allowBlank : false,
					maxLength :25
       			}, {
        			xtype : 'numberfield',       				
					fieldLabel :'电压',
					width: 150,
        			name: 'paramByqQyb.dy',
        			id : 'paramByqQyb.dy',
					allowBlank : false,
					maxLength :8
       			}, {
        			xtype : 'numberfield',
    				allowNegative : false,
    				allowDecimals:false,
					fieldLabel :'功率',
    				width: 150,
        			name: 'paramByqQyb.gl',
        			id : 'paramByqQyb.gl',
					//allowBlank : false,
					maxLength :8
        		}, {
        			xtype : 'numberfield',
    				allowNegative : false,
    				allowDecimals:false,
					fieldLabel :'流量',
    				width: 150,
        			name: 'paramByqQyb.gl',
        			id : 'paramByqQyb.gl',
					//allowBlank : false,
					maxLength :8
       			}, {
        			xtype : 'numberfield',
    				allowNegative : false,
    				allowDecimals:false,
					fieldLabel :'扬程',
    				width: 150,
        			name: 'paramByqQyb.yc',
        			id : 'paramByqQyb.yc',
					//allowBlank : false,
					maxLength :8
       			}, {
        			xtype : 'numberfield',
    				allowNegative : false,
    				allowDecimals:false,
					fieldLabel :'转速',
    				width: 150,
        			name: 'paramByqQyb.zs',
        			id : 'paramByqQyb.zs',
					//allowBlank : false,
					maxLength :8
       			}, {
        			xtype : 'textfield',
					fieldLabel :'生产序号',
    				width: 150,
        			name: 'paramByqQyb.scxh',
        			id : 'paramByqQyb.scxh',
					//allowBlank : false,
					maxLength :25
       			}, {
        			xtype : 'datefield',
					fieldLabel :'生产时间',
    				width: 150,
        			name: 'paramByqQyb.scrq',
        			id : 'paramByqQyb.scrq',
					//allowBlank : false,
        			editable:false,
        			format:'Y-m-d'
       			}, {
        			xtype : 'textfield',
					fieldLabel :'厂家',
    				width: 150,
        			name: 'paramByqQyb.sccj',
        			id : 'paramByqQyb.sccj',
					//allowBlank : false,
					maxLength :50
       			}, {
        			xtype : 'numberfield',
    				allowNegative : false,
    				allowDecimals:false,
					fieldLabel :'数量',
    				width: 150,
        			name: 'paramByqQyb.sl',
        			id : 'paramByqQyb.sl',
					//allowBlank : false,
					maxLength :8
       			}, {
        			xtype : 'textfield',
					fieldLabel :'备注',
    				width: 150,
        			name: 'paramByqQyb.bz',
        			id : 'paramByqQyb.bz',
					//allowBlank : false,
					maxLength :50
        		}, {
        			xtype: 'hidden',
        			name: 'paramByqQyb.id',
        			id:'paramByqQyb.id',
        			value:'0'
        		},{
        			xtype: 'hidden',
        			name: 'paramByqQyb.baseid',
        			id:'paramByqQyb.baseid',
        			value:sbid
        		},{
        			xtype: 'hidden',
        			name: 'sblx',
        			id:'sblx',
        			value:'001-8'
        		},{
        			xtype: 'hidden',
        			name: 'id',
        			id:'id',
        			value:'0'
        		}]
			});

			this.items = [this.grid, this.detail];
			
			business.equipment.byq.Qyb.superclass.initComponent.call(this);

		},
	
		/**
		 * 菜单绑定
		 */
		menuCreate: function (){

			var obj = this;

			var actEdit = new Ext.Action({
				id			: 'menu_edit',
				text		: '修改',
				tooltip		: '修改当前屏柜',
				iconCls		: 'icon_edit',
				handler		: function() { obj.getDetail()}
			});

			var actDelete = new Ext.Action({
				id			: 'menu_delete',
				text		: '删除',
				tooltip		: '删除当前屏柜',
				iconCls		: 'icon_delete',
				hidden      : btn_delete,
				handler		: function() { obj.deleteParam()}
			});
			
			obj.commandMenu = new Ext.menu.Menu({
				minWidth	: 160,
				items	: [
					actEdit, '-',
					actDelete
				]
			});
			
			obj.grid.on('rowcontextmenu',function (grid, rowIndex, e) {
      			e.preventDefault();
      			obj.grid.getSelectionModel().selectRow(rowIndex);
        		obj.commandMenu.showAt(e.getXY());   
			});
			
		},

		/**
		 * 提交保存
		 */
		submit: function() {
			
			var obj = this;
			
			// 验证有效性
        	if (this.detail.getForm().isValid()) {
        		
        		// 重新赋值设备ID
        		obj.detail.getForm().findField("paramByqQyb.baseid").setValue(sbid);

				// 提交
				this.detail.getForm().submit({
					waitMsg :'保存中...',
					url:'equip!saveParam.do',
					success : function(form, action) {
						
						Ext.MessageBox.alert('提示', action.result.msg, function() {
						
							if (!Ext.isEmpty(action.result.id)) {
								obj.detail.getForm().findField("paramByqQyb.id").setValue(action.result.id);
								obj.detail.getForm().findField("id").setValue(action.result.id);
								obj.gridstore.baseParams['id'] = sbid;
								obj.gridstore.reload();
							}
						});
					},
					failure : function(action) {
						Ext.MessageBox.alert('提示', '保存失败。');
					}
				});
        	}
			
		},
		
		/**
		 * 删除
		 */
		deleteParam: function() {
			
			var obj = this;
			
			if (!obj.grid.getSelectionModel().hasSelection()) {
				Ext.MessageBox.alert("提示","请先选择要删除的记录");
				return;
			}
			
			var ids = obj.grid.getSelectionModel().getSelected()['data']['id'];
			
			Ext.MessageBox.confirm('提示', '确定要删除选中的记录吗？', function (btn) {
				
				if (btn == 'yes') {

					Ext.Ajax.request({
						method :'POST',
						url :'equip!deleteParam.do?sblx=001-8',
						params : {
							id :ids
						},
						success : function(response) {
							
							Ext.MessageBox.alert('提示', response.responseText, function () {
								obj.grid.store.reload();
							});
						},
						failure : function() {
							Ext.MessageBox.alert('提示', '删除失败！');
						}
					});
				}

			});
			
		},
		
		/**
		 * 获得详细信息
		 */
		getDetail: function() {

			var record = this.grid.getSelectionModel().getSelected()['data'];
			
			for (var p in record) {
				
				try {
					this.detail.getForm().findField("paramByqQyb." + p).setValue(record[p]);
				} catch (e) {
					
				}
				
				this.detail.getForm().findField('id').setValue(record['id']);
			}
		}
	
	});

	/**
	 * 套管
	 */
	business.equipment.byq.Tg = Ext.extend(Ext.Panel, {
		
		id 			: '9', 
		title		: '套管',
		layout		: 'border',
		
		/**
		 * 绕组参数列表
		 */
		grid : null,
		
		/**
		 * 绕组参数数据源
		 */
		gridstore : null,

		/**
		 * 绕组参数详细信息
		 */
		detail : null,

		/**
	     * 初始化
		 */
		initComponent : function() {
			
			var obj = this;
			
			//----------------------------------------------------------------------
			//	列表数据源
			//----------------------------------------------------------------------
			this.gridstore = new Ext.data.Store({
				proxy :new Ext.data.HttpProxy({
					url :'equip!getParamList.do?sblx=001-9'
				}),
				reader :new Ext.data.JsonReader({
					root :'result',
					totalProperty :'totalCount',
					fields : ['id', 'bdzid', 'sbmc', 'xh', 'eddy', 'eddl','drz','ybh','pdjl','ccbh','scrq','tgph','zl','jysp','yzl','sccj','bz']
				}),
				autoLoad:false,
				remoteSort :false
			});

			//----------------------------------------------------------------------
			//	加载列表
			//----------------------------------------------------------------------
			this.grid = new Ext.grid.GridPanel({
				id					: "byzgrid9",
				store 				: obj.gridstore,
				region 				: 'west',
				width				: 600,
				stripeRows			: true,
				split				: true,
				collapsible			: true,
				animCollapse		: false,
				cm: new Ext.grid.ColumnModel({
	        		defaults: {
	            		sortable: true
	        		},
	        		columns: [
	        			new Ext.grid.RowNumberer(),
	            		//sm,
						{	id:'id',
							header :"序号",
							width :50,
							dataIndex :'id',
							sortable :true,
							hidden :true
						}, {
							header :"设备名称",
							width :100,
							dataIndex :'sbmc',
							sortable :true,
							align:'center'
						}, {
							header :"型号",
							width :100,
							dataIndex :'xh',
							sortable :true,
							align:'center'
						},{
							header :"额定电压",
							width :70,
							dataIndex :'eddy',
							sortable :true,
							align:'center'
						},{
							header :"额定电流",
							width :70,
							dataIndex :'eddl',
							sortable :true,
							align:'center'
						},{
							header :"厂家",
							dataIndex :'sccj',
							sortable :true,
							align:'center'
						}]
				}),
				selModel  : new Ext.grid.RowSelectionModel({singleSelect : true}),
				loadMask : {
					msg :'载入中,请稍候...'
				},
				viewConfig:{
					forceFit:true
				},
				tbar :[
					{
						text :'刷新',
						cls:'x-btn-text-icon',
        				icon:contextpath + '/images/page_find.png',
			            handler:function() {
			            	obj.gridstore.reload();
        				}
					}, btn_delete ? '' : '-',{
						text :'删除',
						cls:'x-btn-text-icon',
        				icon:contextpath + '/images/delete.gif',
        				hidden:btn_delete,
        				handler:function() {
        					obj.deleteParam();
        				}
					}
				],
				bbar : new Ext.PagingToolbar({
					store : obj.gridstore,
					pageSize:100,
					displayInfo :true,
					displayMsg :'共 {2} 条',
					emptyMsg :"没有数据显示！"
				}),
				listeners:{'rowdblclick':function(row) {
					obj.getDetail();
				}}
			});
			
			//----------------------------------------------------------------------
			//	加载详细信息
			//----------------------------------------------------------------------
			this.detail = new Ext.form.FormPanel({
				id : 'byqdetail9',
				region : 'center',
				bodyStyle  : 'padding: 10px; background-color: #DFE8F6',
				method :'POST',
				labelAlign:'right',
				tbar :[
					{
						id :'rz_insert',
						text :'新建',
						cls:'x-btn-text-icon',
        				icon:contextpath + '/images/add.gif',
			            hidden:btn_insert,
        				handler:function() {
        					obj.detail.getForm().reset();
        					obj.detail.getForm().findField("paramByqTg.baseid").setValue(sbid);
        				}
					}, btn_save ? '' : '-',{
						text:'保存',
						icon:contextpath + "/images/save2.gif",
						hidden:btn_save,
						handler: function() {
        					obj.submit();
        				}
					}
				],
		        items: [
	        	{
					xtype : 'textfield',
					fieldLabel :'设备类型',
    				width: 150,
        			name: 'sblxrd9',
        			id : 'sblxrd',
					allowBlank : false,
					readOnly : true,
					value     : sblxname
        		}, {

					xtype : 'textfield',
					fieldLabel :'设备名称',
    				width: 150,
        			name: 'paramByqTg.sbmc',
        			id : 'paramByqTg.sbmc',
					allowBlank : false,
					maxLength :25
       			}, {
        			xtype : 'textfield',       				
					fieldLabel :'型号',
					width: 150,
        			name: 'paramByqTg.xh',
        			id : 'paramByqTg.xh',
					allowBlank : false,
					maxLength :25
       			}, {
        			xtype : 'numberfield',
    				allowNegative : false,
    				allowDecimals:false,
					fieldLabel :'额定电压',
    				width: 150,
        			name: 'paramByqTg.eddy',
        			id : 'paramByqTg.eddy',
					//allowBlank : false,
					maxLength :8
        		}, {
        			xtype : 'numberfield',
    				allowNegative : false,
    				allowDecimals:false,
					fieldLabel :'额定电流',
    				width: 150,
        			name: 'paramByqTg.eddl',
        			id : 'paramByqTg.eddl',
					//allowBlank : false,
					maxLength :8
        		}, {
        			xtype : 'numberfield',
    				allowNegative : false,
    				allowDecimals:false,
					fieldLabel :'电容值',
    				width: 150,
        			name: 'paramByqTg.drz',
        			id : 'paramByqTg.drz',
					//allowBlank : false,
					maxLength :8
        		}, {
        			xtype : 'numberfield',
    				allowNegative : false,
    				allowDecimals:false,
					fieldLabel :'油标号',
    				width: 150,
        			name: 'paramByqTg.ybh',
        			id : 'paramByqTg.ybh',
					//allowBlank : false,
					maxLength :8
        		}, {
        			xtype : 'numberfield',
    				allowNegative : false,
    				allowDecimals:false,
					fieldLabel :'爬电距离',
    				width: 150,
        			name: 'paramByqTg.pdjl',
        			id : 'paramByqTg.pdjl',
					//allowBlank : false,
					maxLength :8
        		}, {
        			xtype : 'textfield',
					fieldLabel :'出厂编号',
    				width: 150,
        			name: 'paramByqTg.ccbh',
        			id : 'paramByqTg.ccbh',
					//allowBlank : false,
					maxLength :25
        		}, {
        			xtype : 'datefield',
					fieldLabel :'出厂日期',
    				width: 150,
        			name: 'paramByqTg.scrq',
        			id : 'paramByqTg.scrq',
					//allowBlank : false,
        			editable:false,
        			format:'Y-m-d'
        		}, {
        			xtype : 'textfield',
					fieldLabel :'套管品号',
    				width: 150,
        			name: 'paramByqTg.tgph',
        			id : 'paramByqTg.tgph',
					//allowBlank : false,
					maxLength :25
        		}, {
        			xtype : 'numberfield',
    				allowNegative : false,
    				allowDecimals:false,
					fieldLabel :'质量',
    				width: 150,
        			name: 'paramByqTg.zl',
        			id : 'paramByqTg.zl',
					//allowBlank : false,
					maxLength :8
        		}, {
        			xtype : 'textfield',
					fieldLabel :'绝缘水平',
    				width: 150,
        			name: 'paramByqTg.jysp',
        			id : 'paramByqTg.jysp',
					//allowBlank : false,
					maxLength :25
        		}, {
       				xtype : 'numberfield',
    				allowNegative : false,
    				allowDecimals:false,
					fieldLabel :'油重量',
    				width: 150,
        			name: 'paramByqTg.yzl',
        			id : 'paramByqTg.yzl',
					//allowBlank : false,
					maxLength :8
        		}, {
        			xtype : 'textfield',
					fieldLabel :'厂家',
    				width: 150,
        			name: 'paramByqTg.sccj',
        			id : 'paramByqTg.sccj',
					//allowBlank : false,
					maxLength :50
        		}, {
        			xtype : 'textfield',
					fieldLabel :'备注',
    				width: 150,
        			name: 'paramByqTg.bz',
        			id : 'paramByqTg.bz',
					//allowBlank : false,
					maxLength :50
        		}, {
        			xtype: 'hidden',
        			name: 'paramByqTg.id',
        			id:'paramByqTg.id',
        			value:'0'
        		},{
        			xtype: 'hidden',
        			name: 'paramByqTg.baseid',
        			id:'paramByqTg.baseid',
        			value:sbid
        		},{
        			xtype: 'hidden',
        			name: 'sblx',
        			id:'sblx',
        			value:'001-9'
        		},{
        			xtype: 'hidden',
        			name: 'id',
        			id:'id',
        			value:'0'
        		}]
			});

			this.items = [this.grid, this.detail];
			
			business.equipment.byq.Tg.superclass.initComponent.call(this);

		},

		/**
		 * 提交保存
		 */
		submit: function() {
			
			var obj = this;
			
			// 验证有效性
        	if (this.detail.getForm().isValid()) {
        		
        		// 重新赋值设备ID
        		obj.detail.getForm().findField("paramByqTg.baseid").setValue(sbid);

				// 提交
				this.detail.getForm().submit({
					waitMsg :'保存中...',
					url:'equip!saveParam.do',
					success : function(form, action) {
						
						Ext.MessageBox.alert('提示', action.result.msg, function() {
						
							if (!Ext.isEmpty(action.result.id)) {
								obj.detail.getForm().findField("paramByqTg.id").setValue(action.result.id);
								obj.detail.getForm().findField("id").setValue(action.result.id);
								obj.gridstore.baseParams['id'] = sbid;
								obj.gridstore.reload();
							}
						});
					},
					failure : function(action) {
						Ext.MessageBox.alert('提示', '保存失败。');
					}
				});
        	}
			
		},
		
		/**
		 * 删除
		 */
		deleteParam: function() {
			
			var obj = this;
			
			if (!obj.grid.getSelectionModel().hasSelection()) {
				Ext.MessageBox.alert("提示","请先选择要删除的记录");
				return;
			}
			
			var ids = obj.grid.getSelectionModel().getSelected()['data']['id'];
			
			Ext.MessageBox.confirm('提示', '确定要删除选中的记录吗？', function (btn) {
				
				if (btn == 'yes') {

					Ext.Ajax.request({
						method :'POST',
						url :'equip!deleteParam.do?sblx=001-9',
						params : {
							id :ids
						},
						success : function(response) {
							
							Ext.MessageBox.alert('提示', response.responseText, function () {
								obj.grid.store.reload();
							});
						},
						failure : function() {
							Ext.MessageBox.alert('提示', '删除失败！');
						}
					});
				}

			});
			
		},
		
		/**
		 * 获得详细信息
		 */
		getDetail: function() {

			var record = this.grid.getSelectionModel().getSelected()['data'];
			
			for (var p in record) {
				
				try {
					this.detail.getForm().findField("paramByqTg." + p).setValue(record[p]);
				} catch (e) {
					
				}
				
				this.detail.getForm().findField('id').setValue(record['id']);
			}
		}
	
	});

	/**
	 * 调压装置
	 */
	business.equipment.byq.Tyzz = Ext.extend(Ext.Panel, {

		id 			: '10', 
		title		: '调压装置',
		layout		: 'border',
		
		/**
		 * 绕组参数列表
		 */
		grid : null,
		
		/**
		 * 绕组参数数据源
		 */
		gridstore : null,

		/**
		 * 绕组参数详细信息
		 */
		detail : null,

		/**
	     * 初始化
		 */
		initComponent : function() {
			
			var obj = this;
			
			//----------------------------------------------------------------------
			//	列表数据源
			//----------------------------------------------------------------------
			this.gridstore = new Ext.data.Store({
				proxy :new Ext.data.HttpProxy({
					url :'equip!getParamList.do?sblx=001-10'
				}),
				reader :new Ext.data.JsonReader({
					root :'result',
					totalProperty :'totalCount',
					fields : ['id', 'bdzid', 'ggxh','ccbh','edtgdl','gddz','jdy','kgzl','mhjz','czjgxh','czjgbh','czjgdydy','sccj','scrq','dy1','dy2','dy3','dy4','dy5','dy6','dy7','dy8','dy9','dy10','dy11','dy12','dy13','dy14','dy15','dy16','dy17','dl1','dl2','dl3','dl4','dl5','dl6','dl7','dl8','dl9','dl10','dl11','dl12','dl13','dl14','dl15','dl16','dl17']
				}),
				autoLoad:false,
				remoteSort :false
			});

			//----------------------------------------------------------------------
			//	加载列表
			//----------------------------------------------------------------------
			this.grid = new Ext.grid.GridPanel({
				id					: "byzgrid10",
				store 				: obj.gridstore,
				region 				: 'west',
				//width				: 370,
				anchor: '100%',
				stripeRows			: true,
				split				: true,
				collapsible			: true,
				animCollapse		: false,
				cm: new Ext.grid.ColumnModel({
	        		defaults: {
	            		sortable: true
	        		},
	        		columns: [
	        			new Ext.grid.RowNumberer(),
	            		//sm,
						{	id:'id',
							header :"序号",
							width :50,
							dataIndex :'id',
							sortable :true,
							hidden :true
						}, {
							header :"开关型号",
							width :70,
							dataIndex :'ggxh',
							sortable :true,
							align:'center'
						}, {
							header :"出厂编号",
							width :100,
							dataIndex :'ccbh',
							sortable :true,
							align:'center'
						}, {
							header :"额定通过电流",
							width :120,
							dataIndex :'edtgdl',
							sortable :true,
							align:'center',
							render:function (v) {
								if (v == '0') {
									return '';
								}
							}
						}, {
							header :"过渡电阻",
							width :120,
							dataIndex :'gddz',
							sortable :true,
							align:'center',
							render:function (v) {
								if (v == '0') {
									return '';
								}
							}
						},{
							header :"生产厂家",
							width :120,
							dataIndex :'sccj',
							sortable :true,
							align:'center'
						}]
				}),
				selModel  : new Ext.grid.RowSelectionModel({singleSelect : true}),
				loadMask : {
					msg :'载入中,请稍候...'
				},
				viewConfig:{
					forceFit:true
				},
				tbar :[
					{
						text :'刷新',
						cls:'x-btn-text-icon',
        				icon:contextpath + '/images/page_find.png',
			            handler:function() {
			            	obj.gridstore.reload();
        				}
					}, btn_delete ? '' : '-',{
						text :'删除',
						cls:'x-btn-text-icon',
        				icon:contextpath + '/images/delete.gif',
        				hidden:btn_delete,
        				handler:function() {
        					obj.deleteParam();
        				}
					}
				],
				bbar : new Ext.PagingToolbar({
					store : obj.gridstore,
					pageSize:100,
					displayInfo :true,
					displayMsg :'共 {2} 条',
					emptyMsg :"没有数据显示！"
				}),
				listeners:{'rowdblclick':function(row) {
					obj.grid.toggleCollapse();
					obj.getDetail();
				}}
			});
			
			//----------------------------------------------------------------------
			//	加载详细信息
			//----------------------------------------------------------------------
			this.detail = new Ext.form.FormPanel({
				id : 'byqdetail10',
				region : 'center',
				bodyStyle  : 'padding: 10px; background-color: #DFE8F6',
				method :'POST',
				labelAlign:'right',
				frame  : true,
				labelWidth: 120,
				autoScroll : true,
				tbar :[
					{
						id :'rz_insert',
						text :'新建',
						cls:'x-btn-text-icon',
        				icon:contextpath + '/images/add.gif',
			            hidden:btn_insert,
        				handler:function() {
        					obj.detail.getForm().reset();
        					obj.detail.getForm().findField("paramByqTyzz.baseid").setValue(sbid);
        				}
					}, btn_save ? '' : '-',{
						text:'保存',
						icon:contextpath + "/images/save2.gif",
						hidden:btn_save,
						handler: function() {
        					obj.submit();
        				}
					}, '-',{
						text:'返回列表',
						icon:contextpath + "/images/bsls.gif",
						handler: function() {
        					obj.grid.toggleCollapse();
        				}
					}
				],
		        items: [
	        	{
    				layout:'column',
    				items:[
    					{	
    						layout:'form',
    						columnWidth:.3,
    						items:[{
								xtype : 'textfield',
								fieldLabel :'设备类型',
			    				width: 100,
			        			name: 'sblxrd10',
			        			id : 'sblxrd',
								allowBlank : false,
								readOnly : true,
								value     : sblxname,
								style:'background:#f0f0f0'
							}]
    					}, {	
    						layout:'form',
    						columnWidth:.3,
    						items:[{
								xtype : 'textfield',
								fieldLabel :'开关型号',
                				width:100,
		            			name: 'paramByqTyzz.ggxh',
		            			id : 'paramByqTyzz.ggxh',
								allowBlank : false,
								maxLength :25
    						}]
    					}, {	
    						layout:'form',
    						columnWidth:.3,
    						items:[{
								xtype : 'textfield',
								fieldLabel :'出厂编号',
                				width:100,
		            			name: 'paramByqTyzz.ccbh',
		            			id : 'paramByqTyzz.ccbh',
								//allowBlank : false
		            			maxLength :25
    						}]
    					}
        			]		
			    },{
    				layout:'column',
    				items:[
    					{	
    						layout:'form',
    						columnWidth:.3,
    						items:[{
			        			xtype : 'numberfield',
			    				allowNegative : false,
			    				allowDecimals:false,
								fieldLabel :'额定通过电流',
			    				width: 100,
			        			name: 'paramByqTyzz.edtgdl',
			        			id : 'paramByqTyzz.edtgdl',
								//allowBlank : false,
								maxLength :8
							}]
    					}, {	
    						layout:'form',
    						columnWidth:.3,
    						items:[{
			        			xtype : 'numberfield',
			    				allowNegative : false,
			    				allowDecimals:false,
								fieldLabel :'过渡电阻',
                				width:100,
		            			name: 'paramByqTyzz.gddz',
		            			id : 'paramByqTyzz.gddz',
								//allowBlank : false,
								maxLength :8
    						}]
    					}, {	
    						layout:'form',
    						columnWidth:.3,
    						items:[{
			        			xtype : 'numberfield',
			    				allowNegative : false,
			    				allowDecimals:false,
								fieldLabel :'极电压',
                				width:100,
		            			name: 'paramByqTyzz.jdy',
		            			id : 'paramByqTyzz.jdy',
								//allowBlank : false,
								maxLength :8
    						}]
    					}
        			]		
			    },{
    				layout:'column',
    				items:[
    					{	
    						layout:'form',
    						columnWidth:.3,
    						items:[{
			        			xtype : 'numberfield',
			    				allowNegative : false,
			    				allowDecimals:false,
								fieldLabel :'开关重量',
			    				width: 100,
			        			name: 'paramByqTyzz.kgzl',
			        			id : 'paramByqTyzz.kgzl',
								//allowBlank : false,
								maxLength :8
							}]
    					}, {	
    						layout:'form',
    						columnWidth:.3,
    						items:[{
								fieldLabel :'灭弧介质',
								name :'mhjz',
								id : 'mhjz',
								xtype : 'combo',
			    				width:100,
								hiddenName : 'paramByqTyzz.mhjz',
								store : new Ext.data.Store({
									proxy : new Ext.data.HttpProxy({
										url : 'dic!getDicJson.do?dic.itemType=MHJZ'
									}),
									reader : new Ext.data.JsonReader({}, ['itemId', 'itemName']),
									autoLoad : true,
									listeners:{'load' : function() {
										var r = new Ext.data.Record({itemId:'', itemName:''});
										Ext.getCmp('mhjz').store.insert(0,r);
										Ext.getCmp('mhjz').store.each(function(item) {
											if (item.get('itemId') == Ext.getCmp('mhjz').getValue()) {
												Ext.getCmp('mhjz').setRawValue(item.get('itemName'));
											}
										});	
									}}
								}),
								displayField : 'itemName',
								valueField : 'itemId',
								forceSelection : true,
								selectOnFocus : true,
								editable : false,
								triggerAction : 'all',
								mode : 'local',
								emptyText:'请选择'
    						}]
    					}]		
			    },{
    				layout:'column',
    				items:[
    					{	
    						layout:'form',
    						columnWidth:.3,
    						items:[{
			        			xtype : 'textfield',
								fieldLabel :'操作机构型号',
			    				width: 100,
			        			name: 'paramByqTyzz.czjgxh',
			        			id : 'paramByqTyzz.czjgxh',
								//allowBlank : false,
								maxLength :25
							}]
    					}, {	
    						layout:'form',
    						columnWidth:.3,
    						items:[{
			        			xtype : 'textfield',
								fieldLabel :'操作机构编号',
			    				width: 100,
			        			name: 'paramByqTyzz.czjgbh',
			        			id : 'paramByqTyzz.czjgbh',
								//allowBlank : false,
								maxLength :25
							}]
    					}, {	
    						layout:'form',
    						columnWidth:.3,
    						items:[{
								fieldLabel :'操作机构电源电压',
								name :'czjgdydy',
								id : 'czjgdydy',
								xtype : 'combo',
			    				width:100,
								hiddenName : 'paramByqTyzz.czjgdydy',
								store : new Ext.data.Store({
									proxy : new Ext.data.HttpProxy({
										url : 'dic!getDicJson.do?dic.itemType=CZJGDYDY'
									}),
									reader : new Ext.data.JsonReader({}, ['itemId', 'itemName']),
									autoLoad : true,
									listeners:{'load' : function() {
										var r = new Ext.data.Record({itemId:'', itemName:''});
										Ext.getCmp('czjgdydy').store.insert(0,r);
										Ext.getCmp('czjgdydy').store.each(function(item) {
											if (item.get('itemId') == Ext.getCmp('czjgdydy').getValue()) {
												Ext.getCmp('czjgdydy').setRawValue(item.get('itemName'));
											}
										});	
									}}
								}),
								displayField : 'itemName',
								valueField : 'itemId',
								forceSelection : true,
								selectOnFocus : true,
								editable : false,
								triggerAction : 'all',
								mode : 'local',
								emptyText:'请选择'
    						}]
    					}]		
			    },{
    				layout:'column',
    				items:[
    					{	
    						layout:'form',
    						columnWidth:.6,
    						items:[{
			        			xtype : 'textfield',
								fieldLabel :'生产厂家',
			    				anchor: '95%',
			        			name: 'paramByqTyzz.sccj',
			        			id : 'paramByqTyzz.sccj',
								//allowBlank : false,
								maxLength :50
							}]
    					}, {	
    						layout:'form',
    						columnWidth:.3,
    						items:[{
    							xtype : 'datefield',
								fieldLabel :'生产日期',
								name :'paramByqTyzz.scrq',
								id : 'paramByqTyzz.scrq',
			    				width:100,
			    				format : 'Y-m-d'
    						}]
    					}]		
			    },{
    				layout:'table',
    				layoutConfig : {
    					columns : 4
    				},
    				defaults:{
    					style   : 'font-size:10pt;'
    				},
    				items:[
    					{
    						html : '<span valign="middle"> 调压档位</span>',
    						rowspan : 18
    					}, {
    						html: '<center>&nbsp;&nbsp;&nbsp;档位位置&nbsp;&nbsp;&nbsp;</center>'
    					}, {	
    						html: '<center>电压（V）</center>'
    					}, {	
    						html: '<center>电流（A）</center>'
    					}, {
    						html:'<center>1</center>'
    					}, {
    						items:[{xtype:'numberfield',id:'paramByqTyzz.dy1',allowNegative : false,allowDecimals:false,maxLength :8}]
    					}, {
    						items:[{xtype:'numberfield',id:'paramByqTyzz.dl1',allowNegative : false,allowDecimals:false,maxLength :8}]
    					}, {
    						html:'<center>2</center>'
    					}, {
    						items:[{xtype:'numberfield',id:'paramByqTyzz.dy2',allowNegative : false,allowDecimals:false,maxLength :8}]
    					}, {
    						items:[{xtype:'numberfield',id:'paramByqTyzz.dl2',allowNegative : false,allowDecimals:false,maxLength :8}]
    					}, {
    						html:'<center>3</center>'
    					}, {
    						items:[{xtype:'numberfield',id:'paramByqTyzz.dy3',allowNegative : false,allowDecimals:false,maxLength :8}]
    					}, {
    						items:[{xtype:'numberfield',id:'paramByqTyzz.dl3',allowNegative : false,allowDecimals:false,maxLength :8}]
    					}, {
    						html:'<center>4</center>'
    					}, {
    						items:[{xtype:'numberfield',id:'paramByqTyzz.dy4',allowNegative : false,allowDecimals:false,maxLength :8}]
    					}, {
    						items:[{xtype:'numberfield',id:'paramByqTyzz.dl4',allowNegative : false,allowDecimals:false,maxLength :8}]
    					}, {
    						html:'<center>5</center>'
    					}, {
    						items:[{xtype:'numberfield',id:'paramByqTyzz.dy5',allowNegative : false,allowDecimals:false,maxLength :8}]
    					}, {
    						items:[{xtype:'numberfield',id:'paramByqTyzz.dl5',allowNegative : false,allowDecimals:false,maxLength :8}]
    					}, {
    						html:'<center>6</center>'
    					}, {
    						items:[{xtype:'numberfield',id:'paramByqTyzz.dy6',allowNegative : false,allowDecimals:false,maxLength :8}]
    					}, {
    						items:[{xtype:'numberfield',id:'paramByqTyzz.dl6',allowNegative : false,allowDecimals:false,maxLength :8}]
    					}, {
    						html:'<center>7</center>'
    					}, {
    						items:[{xtype:'numberfield',id:'paramByqTyzz.dy7',allowNegative : false,allowDecimals:false,maxLength :8}]
    					}, {
    						items:[{xtype:'numberfield',id:'paramByqTyzz.dl7',allowNegative : false,allowDecimals:false,maxLength :8}]
    					}, {
    						html:'<center>8</center>'
    					}, {
    						items:[{xtype:'numberfield',id:'paramByqTyzz.dy8',allowNegative : false,allowDecimals:false,maxLength :8}]
    					}, {
    						items:[{xtype:'numberfield',id:'paramByqTyzz.dl8',allowNegative : false,allowDecimals:false,maxLength :8}]
    					}, {
    						html:'<center>9</center>'
    					}, {
    						items:[{xtype:'numberfield',id:'paramByqTyzz.dy9',allowNegative : false,allowDecimals:false,maxLength :8}]
    					}, {
    						items:[{xtype:'numberfield',id:'paramByqTyzz.dl9',allowNegative : false,allowDecimals:false,maxLength :8}]
    					}, {
    						html:'<center>10</center>'
    					}, {
    						items:[{xtype:'numberfield',id:'paramByqTyzz.dy10',allowNegative : false,allowDecimals:false,maxLength :8}]
    					}, {
    						items:[{xtype:'numberfield',id:'paramByqTyzz.dl10',allowNegative : false,allowDecimals:false,maxLength :8}]
    					}, {
    						html:'<center>11</center>'
    					}, {
    						items:[{xtype:'numberfield',id:'paramByqTyzz.dy11',allowNegative : false,allowDecimals:false,maxLength :8}]
    					}, {
    						items:[{xtype:'numberfield',id:'paramByqTyzz.dl11',allowNegative : false,allowDecimals:false,maxLength :8}]
    					}, {
    						html:'<center>12</center>'
    					}, {
    						items:[{xtype:'numberfield',id:'paramByqTyzz.dy12',allowNegative : false,allowDecimals:false,maxLength :8}]
    					}, {
    						items:[{xtype:'numberfield',id:'paramByqTyzz.dl12',allowNegative : false,allowDecimals:false,maxLength :8}]
    					}, {
    						html:'<center>13</center>'
    					}, {
    						items:[{xtype:'numberfield',id:'paramByqTyzz.dy13',allowNegative : false,allowDecimals:false,maxLength :8}]
    					}, {
    						items:[{xtype:'numberfield',id:'paramByqTyzz.dl13',allowNegative : false,allowDecimals:false,maxLength :8}]
    					}, {
    						html:'<center>14</center>'
    					}, {
    						items:[{xtype:'numberfield',id:'paramByqTyzz.dy14',allowNegative : false,allowDecimals:false,maxLength :8}]
    					}, {
    						items:[{xtype:'numberfield',id:'paramByqTyzz.dl14',allowNegative : false,allowDecimals:false,maxLength :8}]
    					}, {
    						html:'<center>15</center>'
    					}, {
    						items:[{xtype:'numberfield',id:'paramByqTyzz.dy15',allowNegative : false,allowDecimals:false,maxLength :8}]
    					}, {
    						items:[{xtype:'numberfield',id:'paramByqTyzz.dl15',allowNegative : false,allowDecimals:false,maxLength :8}]
    					}, {
    						html:'<center>16</center>'
    					}, {
    						items:[{xtype:'numberfield',id:'paramByqTyzz.dy16',allowNegative : false,allowDecimals:false,maxLength :8}]
    					}, {
    						items:[{xtype:'numberfield',id:'paramByqTyzz.dl16',allowNegative : false,allowDecimals:false,maxLength :8}]
    					}, {
    						html:'<center>17</center>'
    					}, {
    						items:[{xtype:'numberfield',id:'paramByqTyzz.dy17',allowNegative : false,allowDecimals:false,maxLength :8}]
    					}, {
    						items:[{xtype:'numberfield',id:'paramByqTyzz.dl17',allowNegative : false,allowDecimals:false,maxLength :8}]
    					}]	
			    },{
        			xtype: 'hidden',
        			name: 'paramByqTyzz.id',
        			id:'paramByqTyzz.id',
        			value:'0'
        		},{
        			xtype: 'hidden',
        			name: 'paramByqTyzz.baseid',
        			id:'paramByqTyzz.baseid',
        			value:sbid
        		},{
        			xtype: 'hidden',
        			name: 'sblx',
        			id:'sblx',
        			value:'001-10'
        		},{
        			xtype: 'hidden',
        			name: 'id',
        			id:'id',
        			value:'0'
        		}]
			});

			this.items = [this.grid, this.detail];
			
			business.equipment.byq.Tyzz.superclass.initComponent.call(this);

		},

		/**
		 * 提交保存
		 */
		submit: function() {
			
			var obj = this;
			
			// 验证有效性
        	if (this.detail.getForm().isValid()) {
        		
        		// 重新赋值设备ID
        		obj.detail.getForm().findField("paramByqTyzz.baseid").setValue(sbid);

				// 提交
				this.detail.getForm().submit({
					waitMsg :'保存中...',
					url:'equip!saveParam.do',
					success : function(form, action) {
						
						Ext.MessageBox.alert('提示', action.result.msg, function() {
						
							if (!Ext.isEmpty(action.result.id)) {
								obj.detail.getForm().findField("paramByqTyzz.id").setValue(action.result.id);
								obj.detail.getForm().findField("id").setValue(action.result.id);
								obj.gridstore.baseParams['id'] = sbid;
								obj.gridstore.reload();
							}
						});
					},
					failure : function(action) {
						Ext.MessageBox.alert('提示', '保存失败。');
					}
				});
        	}
			
		},
		
		/**
		 * 删除
		 */
		deleteParam: function() {
			
			var obj = this;
			
			if (!obj.grid.getSelectionModel().hasSelection()) {
				Ext.MessageBox.alert("提示","请先选择要删除的记录");
				return;
			}
			
			var ids = obj.grid.getSelectionModel().getSelected()['data']['id'];
			
			Ext.MessageBox.confirm('提示', '确定要删除选中的记录吗？', function (btn) {
				
				if (btn == 'yes') {

					Ext.Ajax.request({
						method :'POST',
						url :'equip!deleteParam.do?sblx=001-10',
						params : {
							id :ids
						},
						success : function(response) {
							
							Ext.MessageBox.alert('提示', response.responseText, function () {
								obj.grid.store.reload();
							});
						},
						failure : function() {
							Ext.MessageBox.alert('提示', '删除失败！');
						}
					});
				}

			});
			
		},
		
		/**
		 * 获得详细信息
		 */
		getDetail: function() {

			var record = this.grid.getSelectionModel().getSelected()['data'];
			
			for (var p in record) {
				
				try {
					this.detail.getForm().findField("paramByqTyzz." + p).setValue(record[p] == '0' ? '' : record[p]);
				} catch (e) {
					
				}
				
				this.detail.getForm().findField('id').setValue(record['id']);
			}
		}
	
	});